我有一個JSON字符串:如何將我的json字符串轉換爲特定的格式?
arguments[0] = [{"one":"1","two":"1","three":"15","four":"esj","five":null,"six":"2015-10-15 00:00:00","seven":null},
{"one":"1","two":"1","three":"15","four":"esj","five":null,"six":"2015-10-15 00:00:00","seven":null},
{"one":"1","two":"1","three":"15","four":"esj","five":null,"six":"2015-10-15 00:00:00","seven":null, ...}]
,我想將其更改爲這樣的格式:
[ '1', '1', '15', 'esj', null, '2015-10-15 00:00:00', null],
[ '1', '1', '15', 'esj', null, '2015-10-15 00:00:00', null],
[ '1', '1', '15', 'esj', null, '2015-10-15 00:00:00', null], etc...
我怎麼能做到這一點jQuery的?
編輯:
使用@Joseph夢者的答案,我幾乎做它的工作,現在我使用:
return ["['"+arg.one+"'", "'"+arg.two+"'", "'"+arg.three+"'", "'"+arg.four+"'", "'"+arg.five+"'", "'"+arg.six+"']"]
和它產生我:
[1,2,3,4,5,6],[1,2,3,4,5,6], etc
這是好,但我需要稍後將其轉換爲字符串。我怎樣才能做到這一點?
使用基本的for循環並自己構建它。 – Blazemonger
@Blazemonger你能告訴我該怎麼做嗎? – user3766930
你的問題很混亂。 [首先你要求_only_將_json(或對象)轉換爲arrays_](http://stackoverflow.com/posts/33223848/revisions),現在你已經修改了你的問題,進一步詢問如何將它轉換爲字符串(可以是另一個問題,[這將是一個重複](http://stackoverflow.com/questions/22746353/javascript-convert-array-to-string-while-preserving-brackets/22746363#22746363))。實際上,在第一次修訂中,你的問題很清楚,格式也很好,可以起到很大的作用。現在它......令人困惑。 :/ –