Terracorrupt's Recent Forum Activity

  • You will probably have to use a plugin that can readily interpret any JSON thrown at it. (https://www.scirra.com/forum/plugin-json_t178836:14r0to40]JSON++ by Nandynho, [url=https://www.scirra.com/forum/plugin-json-import-export-generate-edit-inspect_t100042 JSON by Yann) > > I guess you could also intercept the JSON before loading it as a Dictionary and turn every value in strings, so they could later be loaded into their own dictionaries... there would still be the problem of embedded-embedded objects... but the same logic could still be recursively used. > Ah, the JSON plugin by Yann did the trick! I can drill down into the structure and reference specific keys for data. Thanks!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hey there!

    So, i have a string representation of some JSON, lets say I retrieved this string from a Websocket-based backend.

    Getting the string is fine, but I want to inspect and observe all keys and values, including any embedded documents or arrays.

    Given the string response:

    myJSON = "{"key": "value", "embedded_key: {"embedded_val_1": 0, "embedded_val_2": [1,2,3,4,5]}}"

    ...I can load this such as:

    Dictionary.Load( "{""c2dictionary"":true, ""data"": " & myJSON & " }"

    Which results in a dictionary with 2 keys.

    "key": "value"

    "embedded_key": [Object object].

    Any tips for parsing down the whole line of documents? Should I maybe use some custom plugin that handles JSON better?

    Failing that, can anyone recommend any string manipulation utilities in Construct2 for splitting strings into sub-documents?

Terracorrupt's avatar

Terracorrupt

Member since 14 Dec, 2016

None one is following Terracorrupt yet!

Trophy Case

  • 7-Year Club
  • Email Verified

Progress

8/44
How to earn trophies