Re: [Q] storing JSON, problem with 'escapes' - Mailing list pgsql-php

From Chris
Subject Re: [Q] storing JSON, problem with 'escapes'
Date
Msg-id 492660A7.3060008@gmail.com
Whole thread Raw
In response to [Q] storing JSON, problem with 'escapes'  ("V S P" <toreason@fastmail.fm>)
Responses Re: [Q] storing JSON, problem with 'escapes'  ("V S P" <toreason@fastmail.fm>)
List pgsql-php
V S P wrote:
> Hi,
> I am using PHP's json_encode function on
> an array of strings
> that gives me back a JSON encoded string.
>
> Some of the elements in the string arrays have
> double quotes.  So PHP's json_encode correctly
> escapes them (according to JSON specifications)
> with \.
>
> For example here is a an array element
>
> "if( js_iop_lt(a,b) ){ VLADIKVLADIKVLADIKVLADIK("b2122") ;}"
>
> would get encoded in JSON as
>
> "if( js_iop_lt(a,b) ){ VLADIKVLADIKVLADIKVLADIK(\"b2122\") ;}"

Is magic_quotes_gpc (or magic_quotes_runtime) on for the php server?
Check with a phpinfo() page.

If so, you'll need to "undo" that, see http://www.php.net/stripslashes
(inc. the recursive function stripslashes_deep).

--
Postgresql & php tutorials
http://www.designmagick.com/


pgsql-php by date:

Previous
From: "V S P"
Date:
Subject: [Q] storing JSON, problem with 'escapes'
Next
From: "V S P"
Date:
Subject: Re: [Q] storing JSON, problem with 'escapes'