Questions tagged [jsonbuilder]

78 questions
1
vote
1 answer

Groovy JsonBuilder objects

I'm having some trouble with my JsonBuilder. I'd like the output to look like the following: { "appointmentCheckResult": [ { "itexxmCode": "98765432", " needAppointmentCheckFlag ": "Y" }, { …
Yang
  • 11
  • 1
1
vote
2 answers

How to get key from ArrayList nested in JSON using Groovy and change its value

I need to be able to find the key quote.orderAttributes[0].attributeDetail.name and set its value to null or any other value I want. I only need to do this for the first element in any list so selecting [0] is fine. I want to be able to use a path…
SleepyD
  • 39
  • 1
  • 2
  • 9
1
vote
0 answers

Rails Json Builder syntax error, unexpected keyword_end, expecting end-of-input

I'm using FullCalendar in my app and feed it with a JSON file for the appointments. I recently introduced few conditional but this is the error I get when try to load the appointments.json page index.json.jbuilder:15: syntax error, unexpected…
1
vote
0 answers

how to print json array in jsonobject when we will get element of jsonarrray at runtime

ArrayList al = new ArrayList(); //al[0] and al[1] are the json objects. def json = new JsonBuilder() json { type "rel12" total k xyz "" shows al[0],al[1] emails "" } println json.toPrettyString() i dont want to do the the hardcoding…
abhay kumar
  • 379
  • 1
  • 3
  • 12
1
vote
1 answer

JSON with array and non-array data with Groovy JsonBuilder

I need to create a JSON string in my Groovy script which has some elements that are array and some which are not. For example the below.. { "fleet": { "admiral":"Preston", "cruisers": [ {"shipName":"Enterprise"}, …
AbuMariam
  • 3,282
  • 13
  • 49
  • 82
1
vote
1 answer

SOAPUI - Groovy scripting - jsonBuilder strips quotes

I have a problem where jsonBuilder strips quotes from the result string. How do I format the output to return a JSON response with quotes ? import com.eviware.soapui.support.XmlHolder import net.sf.* import net.sf.json.* import…
1
vote
1 answer

Groovy JsonBuilder array of objects

I have a JsonBuilder that I'm having some trouble with. I'd like the output to look like the following: "unitTests": { "testType": "TestNG", "totalTests": 20, "failedTests": 2, "skippedTests": 0, …
JamesE
  • 3,833
  • 9
  • 44
  • 82
1
vote
2 answers

Groovy JsonBuilder not including collection

I have the following code: def customers = Customer.findAll() def json = new JsonBuilder() json { customers.each { customer -> id customer.id name customer.name address customer.address …
Marcel Overdijk
  • 11,041
  • 17
  • 71
  • 110
1
vote
1 answer

Groovy/Grails: Declaring a JsonBuilder inside a loop without overwriting previously generated jsons

Hello I am trying to create a list of json objects in groovy List relClinicStatementList = [] for (BloodTestRow row in BTList){ def jsonListBuilder = new groovy.json.JsonBuilder() def internalJson =…
neneItaly
  • 263
  • 2
  • 9
1
vote
1 answer

Groovy JSONBuilder with Nested Array in Grails

Is there a way to nest JSON arrays using the JSONBuilder in Groovy? More explicitly, I have a Grails application that needs to render something like this: { "event": { "type": "1.0", "templates": [ { …
anthonylawson
  • 761
  • 9
  • 24
0
votes
1 answer

Postgres. string_agg text column into json

I normally use a script with this structure to insert rows in a postgres table. select 'my_table' as name, '{"my_table":{' || string_agg('"' || nr || code || '":{"code":"' || nr || code || '","name_eng":"' || eng || '","name_de":"' || de ||…
user2210516
  • 613
  • 3
  • 15
  • 32
0
votes
2 answers

NoClassDefFoundError jakarta/json/bind/JsonbBuilder

I am having an error while trying to use Jsonb / JsonbBuilder in a JakartaEE maven project. Error StackTrace java.lang.RuntimeException: jakarta/json/bind/JsonbBuilder at…
Adrianxu
  • 21
  • 4
0
votes
1 answer

modifying json with jsonbuilder for an integer type element in Groovy

Have the following JSON: def jsonString =…
MAX GRIMM
  • 111
  • 8
0
votes
1 answer

Nested XML to flat JSON using groovy

I am still new to groovy. I need to create a flat json file from a nested xml file. I am having a hard time accessing the header fields when I try to create the JSON. this is the input:
Eric C.
  • 63
  • 6
0
votes
1 answer

groovy jsonbuilder remove json node

I try to remove a json node when it contains specific value. but I get an error. Goal is to remove an element from my json by checking its path if it contains a prefix and a suffix could you help me to make my code working ? import…