Skip site navigation (1) Skip section navigation (2)

Re: [Q] storing JSON, problem with 'escapes'

From: Chris <dmagick(at)gmail(dot)com>
To: V S P <toreason(at)fastmail(dot)fm>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: [Q] storing JSON, problem with 'escapes'
Date: 2008-11-21 07:17:59
Message-ID: (view raw, whole thread or download thread mbox)
Lists: 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 
(inc. the recursive function stripslashes_deep).

Postgresql & php tutorials

In response to


pgsql-php by date

Next:From: V S PDate: 2008-11-21 07:43:56
Subject: Re: [Q] storing JSON, problem with 'escapes'
Previous:From: V S PDate: 2008-11-21 06:54:35
Subject: [Q] storing JSON, problem with 'escapes'

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group