Setting deeper nested JSON objects as a String
See original GitHub issueThis is more a question / thought for further enhancement:
The current client.jsonSet(key, Path.ROOT_PATH, object)
assumes a PoJo as the object. I would like to have an additional method that is client.jsonSet(key, Path.ROOT_PATH, string)
that bypasses the JSON serialization. There is a workaround that doesn’t feel intuitive that is to use client.jsonSet(key, Path2.ROOT_PATH, object)
.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
Top Results From Across the Web
How to get deeply nested JSON object in Java - Stack Overflow
You can use Jackson's JsonNode with JsonPath to get ruleId as follows: ObjectMapper mapper = new ObjectMapper(); JsonNode jsonObj = mapper.
Read more >Get Correctly Formatted Deep-Nested JSON Files At Scale ...
This article is focused on the third point, i.e. how to properly manage your result set given by a complex query, in order...
Read more >Mapping Nested Values with Jackson - Baeldung
In this quick tutorial, we'll look at how to map nested values with Jackson to flatten out a complex data structure. We'll deserialize...
Read more >Case Study: How To Parse Nested JSON - PyBites
I've only shown the first author object of the entry list. So the JSON response is structured in the following way:.
Read more >How to Deserialize a Complex JSON Object in C# .NET
As an input parameter, our method receives a JSON string. After the deserialization, it returns a nullable Company with all the data. Learning ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Guess I didn’t describe it well enough. I am not talking about plain strings. I am talking about JSON strings. So a JSON object in its String representation. If I remember correctly this is how RedisJSON works natively. You pass a path and a string that represents the JSON, e.g.
JSON.SET test $ '{ "value" : "strong"}
.So imagine something like the following:
This would currently by design fail because of the built-in serialization/de-serialization, which uses the default Gson builder. I would like to use a custom serializer/de-serializer on the raw JSON strings, but this is not totally intuitive with the current implementation. As said, it’s more a developer experience/usability thing.
Here my 2 pence:
Let me please provide some context and explain what I did that inspired this ticket:
So my example app will be able to access the friends of a person as Person directly (because the repo returns a person), but behind the scenes the repo deals with a physical model that is realized with the help of a custom (De-)Serializer.
Bottom line: I think that it is not uncommon that developers might want to decide in a flexible way how data is stored vs. how it is logically accessed. In that case the built-in JSON (de-)serialization might not be good enough.