AnsweredAssumed Answered

Json created in python is different then the one from GP service

Question asked by modybsystematics-co-il-esridist Employee on Jul 14, 2020

Hello all

I have a python script that gets some parameters and return a json.

It uses the json.dumps(Dictionary) command

When I run it from PyScripter I get a great json (see below).

When I run it from ArcMap (as a tool) or from the GpService the json have a few problems:

1) key (3435) is not quoted.

2) Single quote and not double quote

3) All strings have u (u'461') in the beginning

 

From Gp Service: {3435: {'KM to': '5.0', 'road_num': u'461', ...

From pyScripter: {"3435": {"KM to": "5.0", "road_num": "461"

 

When I put the second string in json beautifier it looks great, the first one does not work at all.

Is there any setting for the json.dumps that make it works?

Outcomes