Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2806

Re: How to convert the odata field value from html format to JSON format?

$
0
0

Hi Sai Vellanki,

 

When I pass the odata in Restclient, I get the value for jobDescription field similar to the below image:

 

screenshot.png

I need to display only the text (excluding all the HTML tags between them ) like the following image.

screen2.png

Code:

   var jjtitle=oData.results[0].jobTitle;

             // alert("jtilte:"+jjtitle);

            sap.ui.getCore().byId("jobtitle").setText("Job tilte: "+jjtitle);

            var jdescs=oData.results[0].jobDescription;

          //  alert(jdescs)

          

            var oHTML = jdescs;          //HTML Element

            var oValue = oHTML.textContent;          //Get the value which is inside HTML Element

            var nObject = {"jobDescription": oValue};

            console.log(oHTML);

 

Here's what I'm getting in console after I tried what you told me...

 

          consoleimg.png

 

Thanks,

Ramya


Viewing all articles
Browse latest Browse all 2806

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>