Hmm, that's curious.
Things like jsonlint pass, but it seems the Python JSON formatter does not
like what you have.
Here's a simple test program:
STRING = """
{ "names": [
"nameA",
"\"double quoted name\"",
"nameB"
] }
"""
import json
print json.loads(STRING)
I'm wondering if this might actually not be valid JSON, or just that there
is a bug in the python json library.
2014-12-15 7:09 GMT-05:00 Lucas, Sascha <[email protected]>:
>
> Hi,
>
> I'm talking to a REST/json webservice via the URI module. The webservice
> is correctly returning a list like this:
>
> { "names": [
> "nameA",
> "\"double quoted name\"",
> "nameB"
> ] }
>
> However the uri module does not retrun the json key, because
> json.loads(content) fails. If I comment out try/expect the last line of
> python trace is:
>
> File "/usr/lib64/python2.6/json/decoder.py", line 227, in JSONArray
> raise ValueError(errmsg("Expecting , delimiter", s, end))
> ValueError: Expecting , delimiter: line 371 column 16 (char 10160)
>
> In the URI module "content" key, the list looks like this (white space
> truncated):
>
> \"names\": [\n \"nameA\",\n \"\"double quoted name\"\",\n \"nameB\"\n ]
>
> I asume, that the backslash preserving the double qoute in JSON must be
> escaped it self:
>
> \"names\": [\n \"nameA\",\n \"\\"double quoted name\\"\",\n \"nameB\"\n ]
>
> Would be nice if someone can provide a quick fix for this problem.
>
> Thanks, Sascha.
>
> Aufsichtsratsvorsitzender: Herbert Vogel
> Geschäftsführung: Michael Krüger
> Sitz der Gesellschaft: Halle/Saale
> Registergericht: Amtsgericht Stendal | Handelsregister-Nr. HRB 208414
> UST-ID-Nr. DE 158253683
>
> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
> Informationen. Wenn Sie nicht der richtige Empfänger sind oder diese E-Mail
> irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
> vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte
> Weitergabe dieser Mail oder des Inhalts dieser Mail sind nicht gestattet.
> Diese Kommunikation per E-Mail ist nicht gegen den Zugriff durch Dritte
> geschützt. Die GISA GmbH haftet ausdrücklich nicht für den Inhalt und die
> Vollständigkeit von E-Mails und den gegebenenfalls daraus entstehenden
> Schaden. Sollte trotz der bestehenden Viren-Schutzprogramme durch diese
> E-Mail ein Virus in Ihr System gelangen, so haftet die GISA GmbH - soweit
> gesetzlich zulässig - nicht für die hieraus entstehenden Schäden.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/383FAD2C9609F74D8F075EFF2B86B57998F2CFD8%40SGIS111.gisa-halle.de
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgw4e%3D1%2Bah34SZXbeXF_OW1r33oDfdHcwSUc_9085YWhLQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.