Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Colon in JSON string

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?

like image 482
ANNE Stahl Avatar asked Jun 25 '10 21:06

ANNE Stahl


1 Answers

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.

like image 134
John Flatness Avatar answered Nov 16 '22 01:11

John Flatness