Skip to main content

I am using a proerties file to store some json values

now i want to read the json values and pass it into the body of http request.

 

I have stored the values as string inside properties files.

the HTTP request payload is able to read the value in string format and content type = application/x-www-form-urlencoded

it is asking to convert it(json) values stored it properties files into the type of java.util.hashmap

 

I am not able to pass it

Please help me on this

1 answer
  1. Jul 21, 2017, 5:46 PM

    Add the property "Content-Type" with value "application/java" or "application/json" either in the http request config or a set-property transfomer.

     

    <http:request config-ref="" path="" method="" doc:name="HTTP">

    <http:request-builder>

    <http:header headerName="Content-Type" value="application/json"/>

    </http:request-builder>

    </http:request>

     

    In Dataweave you can create the hashMap structure to your liking, use the function p('value') to access properties:

     

    %dw 1.0

    %output application/java

    ---

    {

    value: p('property1'),

    value2: p('property2'),

    object2: {

    value3: p('property3'),

    }

    }

0/9000