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

    评论

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮