Forum Discussion

j54321ohn's avatar
j54321ohn
Occasional Visitor
9 months ago

Data formats & structures

While preforming the below similar code assertion failure error is occurring and what would be the solution   def jsonSlurper = new JsonSlurper() def object = jsonSlurper.parseText '''     { "simp...
  • Humashankar's avatar
    9 months ago

    Seems this is inside - JsonSlurper

    JsonSlurper is a class that parses JSON text or reader content into Groovy data structures (objects) such as maps, lists and primitive types like Integer, Double, Boolean and String.

    The class comes with a bunch of overloaded parse methods plus some special methods such as parseText, parseFile and others. For the next example we will use the parseText method. It parses a JSON String and recursively converts it to a list or map of objects. The other parse* methods are similar in that they return a JSON String but for different parameter types.

    More information we have out here - https://docs.groovy-lang.org/latest/html/documentation/core-semantics.html#gpath_expressions

     

    Hope this helps - Happy to help further!!
    Thank you very much and have a great one!

    Warm regards