如何在React Native中提取退格并将其添加到JSON数据?

时间:2018-11-05 17:56:51

标签: arrays json react-native

我有这个JSON:

  "data"{
   "names": ["alfred","anthony","mary","john"],
   "cities": ["nyc","paris", "berlin"]
   }

我想要这个,但是JSON中的数组高度取决于里面有多少数据:

names : alfred, 
        anthony, 
        mary, 
        john
cities : nyc, 
        paris, 
        berlin 

有什么主意吗?

1 个答案:

答案 0 :(得分:0)

var data ={
   "names": ["alfred","anthony","mary","john"],
   "cities": ["nyc","paris", "berlin"]
   }

data.names.join('\n');