Skip to content

Json

Json.dump(json, c=1)
  • Converts the map into a json string.

Parameters

  • json (map): The map you want to convert into json.
  • c (bool): Oneliner mode, 1 means oneliner, 0 means pretty print.

Return

  • (string): The map in json form.

Example

print Json.dump({"key1":{"key2":"val2"}})

Result:

{"key1":{"key2":"val2"}}
Json.loads(json)
  • Converts the json string into a map

Parameters

  • json (string): The string to convert into a map.

Return

  • (string): The map from the json string.

Example

print Json.loads("{""key1"":{""key2"":""val2""}}")

Result:

{"key1": {"key2": "val2"}}