Topic
  • 3 replies
  • Latest Post - ‏2018-05-22T10:38:17Z by HermannSW
Gunjan_05
Gunjan_05
38 Posts

Pinned topic Query

‏2018-05-18T10:48:29Z |

Hi,

I have a query related to xml and json.

i am using existing MPGW which converts XML -->JSONX --> JSON.

Currently now i am getting XML and one of the node contains json message.

Example:

<data>
<field1>Test1</field1>
<field2>{"a":{"b":"c","d":"e"}}</field2>
</data>

When Input contains all fields as XML/String, we are successfully convert to jsonx.

How to convert inside field2 element in jsonx. (jsontojsonx using XSLT).

We have any function which convert JSON to JSONX.

** We have jsonxtojson as last proceesioing action mpgw and its existing framework.

 

 

Updated on 2018-05-19T06:26:04Z at 2018-05-19T06:26:04Z by Gunjan_05
  • HermannSW
    HermannSW
    7944 Posts

    Re: JSON in XML

    ‏2018-05-18T11:58:33Z  

    Hi,

    there is no function you can call to convert JSON to JSONX.

    The conversion is done by DataPower firmware:

    • service request type JSON, you can find JSONX in context __JSONASJSONX
    • convert-http(JSON) action

    You can extract the JSON (string) from the XML, store into a context, and have a later convert-http(JSON) action with that context as input context do the JSONX conversion for you. If further processing is neeed, you need to have another stylesheet xform action doing that.

    This solution has minimal latency overhead.

    You can go for first option and use dp:url-open to send the JSON string against a http://127.0.0.1:somePort service with request type JSON that just returns the generated JSONX.

    Hermann.

    Updated on 2018-05-18T12:00:14Z at 2018-05-18T12:00:14Z by HermannSW
  • Gunjan_05
    Gunjan_05
    38 Posts

    Re: JSON in XML

    ‏2018-05-18T12:10:22Z  

    This is also the good option but we have manage one more service :)

    You can go for first option and use dp:url-open to send the JSON string against a http://127.0.0.1:somePort service with request type JSON that just returns the generated JSONX.

     

    But we dont have any extension function which convert JSON to JSONX

  • HermannSW
    HermannSW
    7944 Posts

    Re: JSON in XML

    ‏2018-05-22T10:38:17Z  
    • Gunjan_05
    • ‏2018-05-18T12:10:22Z

    This is also the good option but we have manage one more service :)

    You can go for first option and use dp:url-open to send the JSON string against a http://127.0.0.1:somePort service with request type JSON that just returns the generated JSONX.

     

    But we dont have any extension function which convert JSON to JSONX

    But we dont have any extension function which convert JSON to JSONX
    >
    correct.