我下面是通过保存在localstorage中的数据从浏览器的控制台中提取的JSON Array。
下面我有两个json对象,我将它们存储在localstorage中,同时通过inputtext将其添加到其中。 它的英寸用双引号(“)表示在商品中
But, on next page where I try to extract and using JSON.parse()
function gives error due to usage of double quotes inside value of goods
0: "{"srno":"1","goods":"Item 1 - 1/2" x 3"","hsncode":"12345","qty":"12","rate":"122/-","taxablevalue":"123.60"}"
1: "{"srno":"2","goods":"Item 2- 1 " x 4" ","hsncode":"1245","qty":"10","rate":"10/-","taxablevalue":"12.15"}"
Please go to https://json.org/example.html and find the issues what is difference between your JSON string and the normal one.
{ “词汇表”:{ “ title”:“示例词汇”, “ GlossDiv”:{ “ title”:“ S”, “ GlossList”:{ “ GlossEntry”:{ “ ID”:“ SGML”, “ SortAs”:“ SGML”, “ GlossTerm”:“标准通用标记语言”, “首字母缩写”:“ SGML”, “ Abbrev”:“ ISO 8879:1986”, “ GlossDef”:{ “ para”:“一种元标记语言,用于创建诸如DocBook之类的标记语言。”, “ GlossSeeAlso”:[“ GML”,“ XML”] }, “ GlossSee”:“标记” } } } } }
您的JSON字符串应用大括号{}引起来。