Grails HTTPBuilder - Posting JSON Data
I've found [this docs](http://groovy.codehaus.org/modules/http-builder/doc/json.html) on how to post JSON data using HttpBuilder. I'm new to this, but it is very straightforward example and easy to follow. Here is the code, assuming I had imported all required dependencies.


    def http = new HTTPBuilder( 'http://client.com/handler.php' )
    http.request( POST, JSON ) { req ->
        body = [name:'bob', title:'construction worker']
       
         response.success = { resp, json ->
            // response handling here
        }
    }

Now my problem is, I'm getting an exception of

    java.lang.NullPointerException
        at groovyx.net.http.HTTPBuilder$RequestConfigDelegate.setBody(HTTPBuilder.java:1131)


Did I missed something? I'll be greatly appreciate any help you can do. Thank you
Grails HTTPBuilder - Posting JSON Data
===

I've found [this docs](http://groovy.codehaus.org/modules/http-builder/doc/json.html) on how to post JSON data using HttpBuilder. I'm new to this, but it is very straightforward example and easy to follow. Here is the code, assuming I had imported all required dependencies.


    def http = new HTTPBuilder( 'http://client.com/handler.php' )
    http.request( POST, JSON ) { req ->
        body = [name:'bob', title:'construction worker']
       
         response.success = { resp, json ->
            // response handling here
        }
    }

Now my problem is, I'm getting an exception of

    java.lang.NullPointerException
        at groovyx.net.http.HTTPBuilder$RequestConfigDelegate.setBody(HTTPBuilder.java:1131)


Did I missed something? I'll be greatly appreciate any help you can do. Thank you