How to deal with this kind of data returned by the backend?

the backend uses C-sharp. The data returned to the front end is shown in the figure below. How to convert it to JSON? Should this situation be handled at the back end or at the front end?

Mar.14,2022

use the rule to get the JSON string in the tag first

/[^><]+(?=<\/string>)/img

then convert to JSON

JSON.parse()

xml with json, inside had better let the backend peel off the outer layer


you treat xml as html, and xml can also use DOM api

such as JQ

var str = $(data).find('string').html()

//xml
var str = $( $.parseXML( data ) ).find('string').html()

Thank you all!

the answer found on the Internet has been successfully converted to JSON.

function success(result){
    if(typeof(result) == "object"){
        result = result.lastChild.firstChild.nodeValue;//xml
        eval("result = "+result);//json
    }
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e547f7-44231.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e547f7-44231.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?