Translate

Wednesday 6 October 2021

Working with Builders JsonBuilder in Groovy Scripting groovy training telugu 63

 Watch This Video


https://youtu.be/oHZfdBgyWA0

-----------------------------------------------------------------------------------------


//json.groovy
import groovy.json.JsonBuilder

JsonBuilder builder =new JsonBuilder()

builder.books{
    currentBook{
        title'The 4 Hour Work week'
        isbn'978-7888-88899'
        author(first:'Timothy',last:'Ferriss', twitter:'@tferriss')
        related'The 4 hour Body ,the 4 hour chef'
    }
    nextBook{
        title'#AskGaryvee'
        isbn'978-7888-889904-4556'
        author(first:'Gary',last:'Vaynerchuck', twitter:'@garyvee')
        related'Jab,Jab,Jab,Right Hook'
    }

}
println builder.toString()
println builder.toPrettyString()


No comments:

Post a Comment

Note: only a member of this blog may post a comment.