Hi Aditya,

In order to preserve the double quotations around the numbers, you can
configure the below property in
<ESB_HOME>/repository/conf/synapse.properties

synapse.commons.json.output.autoPrimitive=false

Thanks,
Manorama

On Wed, Oct 25, 2017 at 11:31 AM, aditya shivankar <
shivankar.adit...@gmail.com> wrote:

> Below is the sample service I have created to Highlight the issues I am
> facing in my project(where the request and response are very big and these
> issues are repeating at many places).
>
> Request :
> {
> "id" : "3",
> "parts" : ["Screen"]
> }
>
> Actual Response :
> {
>     "id": 3,
>     "parts": "Screen",
>     "make": "Tamsung"
> }
>
> Desired Response  :
>
> {
>     "id": "3",
>     "parts": ["Screen"],
>     "make": "Tamsung"
> }
>
> ------------------------------------------------------------
> -------------------------------------------------------
> Issues :
>
> 1.     "parts": "Screen",
>
>        should have been like below
>
>        "parts": ["Screen"],
>
>       i.e. it does not remain array anymore. I understand the array
> consist only one element. But the third party system to which the output of
> this service is sent as input(request) expects the element as array. So I
> need it to be as array.
>
> 2.    "id": 3,
>
> should have been like below
> "id": "3",
> i.e. the string should have been kept as string.
>
>
> ------------------------------------------------------------
> -------------------------------------------------------
> arrayTest.xml :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <api context="/arrayTest" name="arrayTest" xmlns="http://ws.apache.org/
> ns/synapse">
>     <resource methods="POST GET">
>         <inSequence>
>
>             <enrich>
>                 <source clone="true" type="inline">
>                     <make xmlns="">Tamsung</make>
>                 </source>
>                 <target action="child" xpath="//jsonObject"/>
>             </enrich>
>             <enrich>
>                 <source clone="true" xpath="//jsonObject"/>
>                 <target type="body"/>
>             </enrich>
>
>             <respond/>
>         </inSequence>
>         <outSequence/>
>         <faultSequence/>
>     </resource>
> </api>
>
>
>
>
>
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Manorama Perera
Software Engineer
WSO2, Inc.;  http://wso2.com/
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to