This time I will bring you the key valueStringHow to convert the key value string into a json string (with code), what are the things to note when converting the key value string into a json string, the following is a practical case, let’s take a look.
Key-value pair characters to be converted
var respDesc=“cardid=64157001&cardnum=1&sporder_id=PD12160428120635001&sporder_time=20160526101552”; var newstr = respDesc.replace("=",":\""); var stringObj= "{" +newstr.replace("&","\",") + "\"}";
Detailed explanation of using jQuery compound selector method
How to use Angular one-way data flow
What are the ways vue-cli can shorten the first screen loading time
The above is the detailed content of How to convert key-value string into json string (code attached). For more information, please follow other related articles on the PHP Chinese website!