开发者

Colon in JSON string

开发者 https://www.devze.com 2023-01-04 15:27 出处:网络
开发者_开发百科Can I escape a colon : that is inside a JSON string? Currently this object/value set
开发者_开发百科

Can I escape a colon : that is inside a JSON string? Currently this object/value set

{ pn: "MT46H128M16LFCK-5 IT:A", 
  visible: false, 
  url: "/$ws$/29/1/products/ProductDetails.html?product=products/dram/MT46H128M16LFCK-5 IT" 
}

doesn't get read. I suspect it's due to the :A in the pn value. How do I escape it or otherwise grab it?


If that's your actual JSON, your problem is that the identifiers (pn, visible, url), need to be quoted ("pn", "visible", "url").

As the comment said, colons don't need to be escaped in JSON string literals.

0

精彩评论

暂无评论...
验证码 换一张
取 消