2

Hi I am using IBM Datapower.I have a question

Can we send html content to json through jsonx.. like

<json:object>
<json:string name="htmlcontent"> <html><body>hiii</body></html></json:string>
</json:object>

I tried like the above i got response just a string

hii 

I need

<html><body>hiii</body></html>

Is it possible?

gen_Eric
  • 223,194
  • 41
  • 299
  • 337
Ironman
  • 556
  • 3
  • 7
  • 21

2 Answers2

0

If your looking in browser you will see only hii

do a view source on browser.

or send request through SOAP UI.

Pravin
  • 21
  • 4
0

As the content of the element is in fact XML (as DataPower will see it) the value of json:object/json:string/html/body is "hiii". If you do a value-of on the above you'll get "hiii" only.

You will need to grab the element (copy-of) like json:object/json:string/ and then serialize the node you get in return to get the actual string including the html tags.

Also note that if you do not send "XML valid" HTML it will fail!

You should consider escaping the html code prior to converting to JsonX.

Anders
  • 3,198
  • 1
  • 20
  • 43