question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Able to parse/deserialize dynamic keys or field

See original GitHub issue

What is your use-case and why do you need this feature? I want to build a dynamic UI based on JSON Schema here: https://rjsf-team.github.io/react-jsonschema-form/

Does it currently possible to parse dynamic key like this?

  "properties": {
    "firstName": {
      "type": "string",
      "title": "First name",
      "default": "Chuck"
    },
    "telephone": {
      "type": "string",
      "title": "Telephone",
      "minLength": 10
    },
    3: {
      "type": "string",
      "title": "Telephone",
      "minLength": 10
    }
  }

Describe the solution you’d like Is this the possible to do it like this?

data class MyJsonSchema(
   val properties: Map<Any, MyDefaultProperties>
)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:8
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
sandwwraithcommented, Jan 18, 2021

JsonElement.jsonObject returns JsonObject which is a Map<String, JsonElement> — you can convert recursively. You can also search for hints in this thread: https://github.com/Kotlin/kotlinx.serialization/issues/746

1reaction
sandwwraithcommented, Jan 18, 2021

@mochadwi It’s still better to use JsonElement than Map<Any, ...>

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parse (Deserialize) JSON with dynamic keys (C#)
you don't need to deserialize, you can parse var jsonParsed=JObject.Parse(json); string[] previewNames= ((JArray)jsonParsed["objects"]) .
Read more >
How to Deserialize JSON Into Dynamic Object in C# - Code ...
Describe how to deserialize JSON into dynamic object in C# with detail explanation and examples using native and Newtonsoft library.
Read more >
apex - Way to parse JSON object with dynamic number of fields
I don't think it can be converted to an apex object in your case.won't JSON.deserializeUntyped() to iterate result section data as key-value ...
Read more >
How to parse Dynamic JSON String? - Numpy Ninja
You will see the key-value pair of "key1" as a JavaScript Object property in the above JSON. In the real world, the JSON...
Read more >
Android parse JSON Key dynamically | by Marwa Eltayeb
JSON stands for JavaScript Object Notation. It is an independent data exchange format and is the best alternative for XML. As a refresher,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found