I have this json and I want to be able to sort it by multiple field values of different types while retaining the previous sort order. The fields by which I should decide to sort it are given through another json: I managed to achieve this by converting the json array to a list of Hashmap<String,Object> and wrote a custom
Tag: json
Getting a list of JSON Users objs. in a POST request and return a response also as JSON
This is my first time using spring-webflux with SpringBoot. My goal is to create an API that accepts a list of Users in JSON format in the body of a POST and return a response with that list also in JSON format ordered by a date field. The ordering is not a problem but I do not know very well
Why does jackson convert byte array to base64 string on converting to json?
When I have a byte array in a DTO and convert it to json using jackson’s ObjectMapper, it automatically converts the byte array into base64 string. Example below. I expected jackson to convert it to an array of integers like the following: But instead, I found it to be converted to base64 string. After researching a bit, It seems json
Collect all elements in a JSON file into a single list
I am using Gson 2.8.1+ (I can upgrade if needed). If I have the JsonObject: … how can I convert this efficiently to the form: Answer Simple example:
RestAssured – want to verify the body structure of JSON response in RestAssured
When i request for GET request, I’m getting the JSON response, but here my requirement is to validate the structure of response body. For example: The above response having structure, so i need to validate structure instead of one key value pair, how i can achieve this? Answer The best way is to verify json-schema matching. Firstly, you need to
Sending JSON Data to JPOS Based Project but failed in unpacking field 34
Request that i send : {“transactionid”:”12″, “ISOMsg”:”010046552063310518890000000000000123001203210541330012003255399022004655206331051889=…
Get object from .readEntity
I have a java service which calls an API and gets the following in return How can i use .readEntity (or something else) to get the object for a given field; say service2 Or just convert all objects inside status to a List<> of objects String output = response.readEntity(String.class); works, but i dont know how to parse it properly to
Java show/hide object fields depending on REST call
Is it possible to config the Item class that depending on the REST call to show and hide specific fields? For example I want to hide colorId (and show categoryId) from User class when calling XmlController and vice versa when calling JsonController. Item class JSON Controller XML Controller Answer I’ve solved it by creating following View: With this config it
Getting the value from the response element using GPath and Rest Assured
I want to get the value of status from my response. So that i can assert it. I’m using rest assured with java & serenity BDD. Response So, here the event id (66e326db-fbfb-4f6e-9d2b-9425e7test5) is dynamic, which means for each run this UUID will get change. Code When i run this, i’m getting Unrecognized Exception from serenity BDD. I think, that
Error parsing JSON (MismatchedInputException)
I’m having problems parsing JSON, this is the error: And I know why it is happening I just don’t know how to fix it. This JSON works: This one does not: The problem seems to be the { character in front of the info field because with [ works. So this is the method I’m using to parse the JSON: