JSON.stringify turns an object in to a JSON text and stores that JSON text in a string.
1 2 3 4 5 6 7 8 9 10 11 |
JSON.stringify({ name: "Jim Cowart", country: "Jimbabwe" }); // produces: "{"name":"Jim Cowart","country":"Jimbabwe"}" JSON.stringify("Oh look, a string!"); // produces ""Oh look, a string!"" JSON.stringify([1,2,3,4,"open","the","door"]); // produces "[1,2,3,4,"open","the","door"]" |
鱼香肉丝 10 0.9 9 38 342
汉堡 15 0.9 13.5 46 621
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
myData : { "total":2, "rows": [{"productName":"鱼香肉 丝", "price":10,"discount":0.9, "priceAfterDiscount":9, "count":"38", "totalAccoumt":342 }, { "productName":"汉堡", "price":15, "discount":0.9, "priceAfterDiscount":13.5, "count":"46", "totalAccoumt":621 } ]} |