Hi ,

My Question is while printing //jsonObject  I am able to print enriched
value tag "Value" as well.

But while printing $ "value" element is missing . While both logs are
printed at same location in flow.


Log print of *//jsonObjec*t after enrichment:

<jsonObject>
<a>d8ccf265-6651-468f-8d1f-d935c3c7d857</a>
<b>57</b>
*<Value>PartyId</Value>*
</jsonObject>

Log print of* json-eval($) *at same place after enrichment : *Value tag
missing*

{
                "a": "d8ccf265-6651-468f-8d1f-d935c3c7d857",
                "b": "57"

}


My Question is *not *why we are printing xml for //jsonObject.
Please guide.
I think *$* and *//jsonObject *or *$body* are representation of same object
just in different formats, at any point in flow.
Then why //jsonOject and $ are printing different jsons at same location in
API.

Thanks,
Aditya

On Fri, Jan 19, 2018 at 9:35 AM, Senduran Balasubramaniyam <
sendu...@wso2.com> wrote:

> Hi Aditya,
>
> //jsonObject is an XPATH expression. When you apply an XPATH evaluation on
> a JSON, ESB / EI internally convert the JSON to XML, that's why you are
> seeing XML for //jsonObject xpath evaluation.
> Since you are sending a JSON payload it is good to use $ (which is a JSON
> path)
>
> Regards
> Senduran
>
> On Fri, Jan 19, 2018 at 3:28 AM, aditya shivankar <
> shivankar.adit...@gmail.com> wrote:
>
>> Respected Sir,
>>
>> //jsonOject and $ are printing different jsons at same location in API.
>>
>> Are not both suppose to have latest json payload,
>>
>> //jsonObject - latest json payload in xml format
>>
>> $ -  latest json payload in json format ?
>>
>> Input json:
>>
>> {
>>                 "token": "d8ccf265-6651-468f-8d1f-d935c3c7d857",
>>                 "partyId": "2920394"
>>
>>
>> }
>>
>> Log print of //jsonObject after enrichment:
>>
>> <jsonObject>
>> <a>d8ccf265-6651-468f-8d1f-d935c3c7d857</a>
>> <b>57</b>
>> <Value>PartyId</Value>
>> </jsonObject>
>>
>> Log print of json-eval($) at same place after enrichment : Value tag
>> missing
>>
>> {
>>                 "a": "d8ccf265-6651-468f-8d1f-d935c3c7d857",
>>                 "b": "57"
>>
>> }
>>
>>
>> Please find attached Rest api "sample.xml"
>>
>>
>> I am facing this issue , when I have to assign current json payload, to
>> one element of new json I created in payload factory.
>>
>> Inside payloadFactory I defined something like this:
>> {
>>  "a" : $1 ,
>>  "b":"thampi"
>> }
>>
>> In args,
>>
>> Type :Expression , Value:$ , evaluator: json
>>
>> But it is assigning the payload which was present before enrichment.which
>> is wrong .
>>
>> Please guide.
>>
>>
>>
>> .
>>
>> [image: Inline image 2]
>>
>>
>> Thanks,
>> Aditya
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> *Senduran *
> Senior Software Engineer,
> WSO2, Inc.;  http://wso2.com/ <http://wso2.com/>
> Mobile: +94 77 952 6548
>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to