douzha5990 2018-06-02 18:20
浏览 294

如何使用const列表显示json数据

how to display json data over fire in but how to call it using (const list =) example like this

const list = [
{
id: 1,
name: 'June 1, 2018 - June 3, 2018',
avatar_url: 'https://s3.amazonaws.com/uif…/faces/twitter/ladylexy/128.jpg',
subtitle: 'Sick Leave 3 Days',
image_status: require('../../assets/icon_double_check_gray.png')
},
{
id: 2,
name: 'July 7, 2018 - August 3, 2018',
avatar_url: 'https://s3.amazonaws.com/…/fa…/twitter/adhamdannaway/128.jpg',
subtitle: 'Meeting Leave 9 Days',
image_status: require('../../assets/icon_double_check_green.png')
},
]
  • 写回答

2条回答 默认 最新

  • dskvfdxgdo2422392 2018-06-02 22:53
    关注

    in react native , you can use javascript methods and in your case , for working with Json , you can use this 2 methods

     JSON.stringify(yourJsonData)
    

    or use

    JSON.parse(yourJson)
    

    if you are new in javascript and you dont know this methos

    JSON.Parse() => this methods get String with JSON fromat ( for example you get this string from server or read from Database ) and translate Your string to Real JSON script

    JSON.stringify() => this method like previous but reversed , for example you have JSON data and you want send this JSON data to server as String , this method Traslate your Json Format type to String for saving in database or used for GET or POS request

    评论

报告相同问题?

悬赏问题

  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法