Questions tagged [jsonnode]

89 questions
0
votes
1 answer

How to check JsonNode value is empty or not : java

I want to check Jsonnode value is present or not, As shown below myObj is an input. in this name is a key and "" is a value. I want to check if I get "" value then it should be go in else part. I tried by using following code but its not…
user8995182
  • 175
  • 3
  • 6
0
votes
1 answer

Mapping ConsumerRecord to Element - What are JsonFactory and ObjectMapper equivalent for XML?

I have a function that takes in kafka ConsumerRecords records and what I need to do is make an Element object out of each record. Below is how it works for the Json implementation where I create a JsonNode object for each record. for…
Kal
  • 1
0
votes
0 answers

com.fasterxml.jackson.core.JsonParseException: Illegal character ((CTRL-CHAR, code 31)) - gives 200 OK res, but fails

I have encountered an issue when I receive an response from another controller. Workflow -> Controller A (http://localhost:8081/) will send request to Controller B *(http://localhost:8082/) *to some endpoint and eventually Controller B, after…
Saiprasad Rai
  • 11
  • 2
  • 4
0
votes
1 answer

C# migrating to Core, how can I retrieve a System.Text.Json.JsonNode element so I don't have to use .ToString()?

I'm migrating code from .Net Framework to Core and without getting into the reason why I want to do this, I'll just keep it simple and focus on what I want to do. Let's say I have a jsonString that contains "Name". I parse the string with: …
Velocedge
  • 1,222
  • 1
  • 11
  • 35
0
votes
2 answers

Apply some condition on jsonnode and filter resultset in Java

I have an array of Jsonnodes. something like that [ { "coupon": "VAR", "currency": "USD", "sip": "94989WAX5", "lastModifiedDate": "2022-09-23T08:16:25Z" }, { "coupon": "VAR1", "currency": "USD", "sip": "94989WAX5", …
Sumit Sood
  • 441
  • 7
  • 23
0
votes
1 answer

How to efficiently merge two JSON Strings based on a common key

I have two JSON strings which are essentially arrays of JSONObject. The two JSON strings have below structure and keys: JSON-1: [ { "title": "ABC", "edition": 7, "year": 2011 }, { "title": "DEF", …
New2Java
  • 273
  • 1
  • 4
  • 19
0
votes
1 answer

How do I get a value from a JsonNode array?

I have such a json response: "data": [ { "id": "1", "login": "name", "display_name": "dName", "type": "", "broadcaster_type": "", "description": "", …
Alpharius
  • 489
  • 5
  • 12
0
votes
0 answers

Reading from a file but getting null in java

I want to read from a file and store it in a string. This is my method: public static String createJsonFileFromNode(String filename, JsonNode root) { String dirName = "src/test/resources/json/"; File dir = new File (dirName); File…
Rumi
  • 61
  • 1
  • 9
0
votes
1 answer

Treves the JSON object and manipulate the value in java

What im trying to do is JSON: { aKey:{ aChildKey:"" }, bKey:"" } expected: aKey:{ aChildKey:"aKey.aChildKey" }, bKey:"bKey" } Please can some one help me in getting the expected the value
0
votes
1 answer

spring-webflux : How to Extract user defined object from Mono or Flux from the response without blocking?

getUserDetails Method returns Mono of Type JsonNode. But I Actually want to return a Mono or Flux. please help modifying getBulkUserInfo or getUserDetails to get the Mono or Flux public Mono
0
votes
1 answer

Assertj not working with Jackson JsonNode

I'm using assertj and Jackson's JsonNode combined. So far I've been using Assertions.assertThat(objectNode0).isEqualTo(objectNode1); and everything works fine. Now, I need to ignore some fields in the comparison, and the way I tried is by using…
0
votes
1 answer

How can we iterate all subNodes of a jsonNode object?

I want to iterate through all nodes of a JsonNode object, And want fetch price details from below JsonNode object , Can some one help me how can we fetch below price details response { "content": { "cart": { "logs": { …
Krish
  • 4,166
  • 11
  • 58
  • 110
0
votes
1 answer

Cannot invoke "com.fasterxml.jackson.databind.JsonNode.numberValue()"

Hi I'm trying to convert JSON data to class, I use the method of deserializing like that: public class GroupDeserlialize extends StdDeserializer { public GroupDeserlialize() { this(null); } public GroupDeserlialize(Class vc) { …
Takwa
  • 55
  • 2
  • 11
0
votes
1 answer

Adding new items to ArrayNode with updates in JsonNode

I was trying to add new array items to the JsonNode with updates in below code. String request = "{\n" + " \"item1\": 123,\n" + " \"item2\": \"desc 1\",\n" + " \"item3\": [{\"field1\": \"desc 1\", \"field2\":…
Shabar
  • 2,617
  • 11
  • 57
  • 98
0
votes
1 answer

How can i add additional field to each object in array node using jackson java?

i have list of masters that have two fields that are name and rating and after serialization to array node i need to add one more field to each object for example i have…
DozezQuest
  • 179
  • 7