Questions tagged [jsonnode]
89 questions
1
vote
1 answer
Map a JsonNode object to a String field in SQL DB JPA
I got a Sql table with these fields:
id uniqueidentifier primary key,
<--Omitting extra fields -->
metadata nvarchar(max)
Which I also have a Entity mapped to it:
@Data
public class GenericEntity implements Serializable {
@Id
…

PopperJuan
- 175
- 1
- 16
1
vote
2 answers
Edit object in nested array in json object with JsonNode
I was trying to edit object in nested array item "field2": "desc 2" to "field2": "xxxx" in below json:
{
"item1": 123,
"item2": "desc 1",
"item3": [
{
"field1": "desc 1",
"field2": "desc 2"
}
]
}
I tried this solution…

Shabar
- 2,617
- 11
- 57
- 98
1
vote
1 answer
How to replace keys in a map based on mapping
I have a JSON that I'm getting from some external system. I need to convert that JSON into key value based on my system mapping. For instance:
JSON from external system:
[{
"name": "Tim",
"address": "New York",
"education"…

codeluv
- 305
- 1
- 15
1
vote
1 answer
JsonNode - null pointer exception
I need to get the value in this arrayNode (Just in case, I know it's going to be only one value in the array - Please, don't ask me why, It is the way that I'm receiving it):
"data": {
"services": [
"ISP3100008972@some.com"
]
}
I'm…

Javier Irrazábal
- 23
- 1
- 5
1
vote
0 answers
Persist Set through JPA
How to persist Set as one entry in the oracle database row using JPA.
Which will be best option convert set to jsonNode and storing as BLOB
or Single string and storing as BLOB ?

Aditya Singh Bisht
- 11
- 1
1
vote
1 answer
Best practice to check contains key and check for null/empty in JSON?
I will receive the following JSON request to my service.
{
"city" : "Hyderabad",
"state" : "Telangana",
"country" : "India"
}
Sometimes In the request, I might not get the city field or city field might be empty which is not expected. So, I'm…

Pavan
- 543
- 4
- 16
1
vote
2 answers
How to map a JsonNode into a java object with Commercetools SphereJsonUtils.readObjects with nested objects?
I can’t seem to work out the nested objects from a Json response. Here is my code:
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import…

Eva
- 11
- 2
1
vote
0 answers
How to fetch JsonNode values using string variable as key?
I am trying to fetch values from a JsonNode in order to carry out some validations.
However, I get null when i try to fetch the value using a predefined variable (String).
When I fetch the same value using hardcoded key, it gives me the correct…

Mohammed Idris
- 768
- 2
- 9
- 26
1
vote
1 answer
How to convert a Java object to a Jackson ObjectNode?
I have a Java object class, say, Student. How to convert it to an ObjectNode? It can be a nested object (multi-level nesting).
I am trying following code to convert the object to ObjectNode, but it is first converting the object to a String and then…

Richa Gupta
- 143
- 3
- 10
1
vote
1 answer
Filter JsonNode Array in Jackson without Iterating
Json:
{
"type":"book",
"children":[
{
"key":"123",
"name":"book1"
},
{
"key":"456",
"name":"book2"
]
}
]
}
I just want to get the name of the book as string when…

topcan5
- 1,511
- 8
- 30
- 54
1
vote
1 answer
How to get value from child jsonnode using java
I need to get codec value from jsonnode using java. The following is the jsonnode with parent and child nodes.
{
"DetectedProperties":{
"Bitrate":262610704,
"FrameRate":"24/1",
"FileSize":32827252,
"Height":1080,
…

SST
- 2,054
- 5
- 35
- 65
0
votes
2 answers
Add data at child level in JSON Object
I want to merge JSON Object to master JSON Object at required depth
Master JSON
{
"data":{
"barrel":{
"length":100,
"stage":[0,1,2]
},
"a":100,
"b":200
}
}
New JSON Object to be added at path data.barrel
{
…

Pranav
- 103
- 7
0
votes
2 answers
How to get all lines of JSON without knowing schema with JsonNode?
Let's say I am expecting a simple JSON response from an API like so:
{
"message": "Source: ",
"incomingUrl": "https://10.1.1/api/echo",
"incomingHeadersCount": 21,
"apiVersion": "1.0"
}
I can use JsonNode to parse it and output the lines.…

AlbatrossCafe
- 1,710
- 6
- 26
- 49
0
votes
1 answer
Regex to remove special characters from a Json node
I have a JSON node as below from which I need to remove all the values after # like DynamicAttribute#1279930005#ZZ8400 to DynamicAttribute
{
"uniqueCode": "ZZ",
"entity": "PROFILE",
"id": "e2b627b360d664377b227b--70378143#1",
"data": [
…

Scarlett John
- 99
- 1
- 11
0
votes
3 answers
How to add field names and values of a json object into List using jsonNode
I have an expected json file as below. It is a nested object
{
"contact_info": [{
"contact_id": "Contact_001",
"contact_status": {
"exam_status": 0,
"term_list": [{
"term_code": 110,
…

TaraNG
- 17
- 4