JSON decode?
Andre Pany via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Sep 27 04:56:32 PDT 2016
On Tuesday, 27 September 2016 at 10:45:45 UTC, Andre Pany wrote:
> Hi,
>
> from a rest call I get a JSON with a strange format:
>
> {"DEPLOY_ATTRIBUTES":"{\n \"dependency-type\":
> \"soft\"\n}","MTA_METADATA":"{\n \"id\":...
>
> The sub objects are enclosed with quotes and there are a lot of
> line break characters.
> Also the quotes are escaped.
> I try to translate a Python script which has no issues to
> handle this JSON correctly,
> but I do not understand why.
>
> Python seems to handle this with decode('utf-8')? Is there some
> functionality in Phobos to handle this format correctly?
>
> Kind regards
> André
OK, I found the solution. There is no magic in python. For these
kinds of attributes the python code checks whether it is a
string, and then tries to parse again as JSON, wired!
Kind regards
André
More information about the Digitalmars-d-learn
mailing list