cx1192724521
2021-08-31 23:04
采纳率: 0%
浏览 25

怎么用rust解析get请求的json数据?把location里的所有name和id对应并提取出来?

{"code":"200","location":[{"name":"北京","id":"101010100","lat":"39.90498","lon":"116.40528","adm2":"北京","adm1":"北京市","country":"中国","tz":"Asia/Shanghai","utcOffset":"+08:00","isDst":"0","type":"city","rank":"10","fxLink":" http://hfx.link/2ax1%22%7D,%7B%22name%22:%22%E6%B5%B7%E6%B7%80%22,%22id%22:%22101010200%22,%22lat%22:%2239.95607%22,%22lon%22:%22116.31031%22,%22adm2%22:%22%E5%8C%97%E4%BA%AC%22,%22adm1%22:%22%E5%8C%97%E4%BA%AC%E5%B8%82%22,%22country%22:%22%E4%B8%AD%E5%9B%BD%22,%22tz%22:%22Asia/Shanghai%22,%22utcOffset%22:%22+08:00%22,%22isDst%22:%220%22,%22type%22:%22city%22,%22rank%22:%2215%22,%22fxLink%22:%22http://hfx.link/2ay1%22%7D,%7B%22name%22:%22%E6%9C%9D%E9%98%B3%22,%22id%22:%22101010300%22,%22lat%22:%2239.92149%22,%22lon%22:%22116.48641%22,%22adm2%22:%22%E5%8C%97%E4%BA%AC%22,%22adm1%22:%22%E5%8C%97%E4%BA%AC%E5%B8%82%22,%22country%22:%22%E4%B8%AD%E5%9B%BD%22,%22tz%22:%22Asia/Shanghai%22,%22utcOffset%22:%22+08:00%22,%22isDst%22:%220%22,%22type%22:%22city%22,%22rank%22:%2215%22,%22fxLink%22:%22http://hfx.link/2az1%22%7D,%7B%22name%22:%22%E6%98%8C%E5%B9%B3%22,%22id%22:%22101010700%22,%22lat%22:%2240.21808%22,%22lon%22:%22116.23590%22,%22adm2%22:%22%E5%8C%97%E4%BA%AC%22,%22adm1%22:%22%E5%8C%97%E4%BA%AC%E5%B8%82%22,%22country%22:%22%E4%B8%AD%E5%9B%BD%22,%22tz%22:%22Asia/Shanghai%22,%22utcOffset%22:%22+08:00%22,%22isDst%22:%220%22,%22type%22:%22city%22,%22rank%22:%2223%22,%22fxLink%22:%22http://hfx.link/2b31%22%7D,%7B%22name%22:%22%E6%88%BF%E5%B1%B1%22,%22id%22:%22101011200%22,%22lat%22:%2239.73553%22,%22lon%22:%22116.13916%22,%22adm2%22:%22%E5%8C%97%E4%BA%AC%22,%22adm1%22:%22%E5%8C%97%E4%BA%AC%E5%B8%82%22,%22country%22:%22%E4%B8%AD%E5%9B%BD%22,%22tz%22:%22Asia/Shanghai%22,%22utcOffset%22:%22+08:00%22,%22isDst%22:%220%22,%22type%22:%22city%22,%22rank%22:%2223%22,%22fxLink%22:%22http://hfx.link/2b81%22%7D,%7B%22name%22:%22%E9%80%9A%E5%B7%9E%22,%22id%22:%22101010600%22,%22lat%22:%2239.90248%22,%22lon%22:%22116.65860%22,%22adm2%22:%22%E5%8C%97%E4%BA%AC%22,%22adm1%22:%22%E5%8C%97%E4%BA%AC%E5%B8%82%22,%22country%22:%22%E4%B8%AD%E5%9B%BD%22,%22tz%22:%22Asia/Shanghai%22,%22utcOffset%22:%22+08:00%22,%22isDst%22:%220%22,%22type%22:%22city%22,%22rank%22:%2223%22,%22fxLink%22:%22http://hfx.link/2b21%22%7D,%7B%22name%22:%22%E4%B8%B0%E5%8F%B0%22,%22id%22:%22101010900%22,%22lat%22:%2239.86364%22,%22lon%22:%22116.28696%22,%22adm2%22:%22%E5%8C%97%E4%BA%AC%22,%22adm1%22:%22%E5%8C%97%E4%BA%AC%E5%B8%82%22,%22country%22:%22%E4%B8%AD%E5%9B%BD%22,%22tz%22:%22Asia/Shanghai%22,%22utcOffset%22:%22+08:00%22,%22isDst%22:%220%22,%22type%22:%22city%22,%22rank%22:%2225%22,%22fxLink%22:%22http://hfx.link/2b51%22%7D,%7B%22name%22:%22%E5%A4%A7%E5%85%B4%22,%22id%22:%22101011100%22,%22lat%22:%2239.72890%22,%22lon%22:%22116.33803%22,%22adm2%22:%22%E5%8C%97%E4%BA%AC%22,%22adm1%22:%22%E5%8C%97%E4%BA%AC%E5%B8%82%22,%22country%22:%22%E4%B8%AD%E5%9B%BD%22,%22tz%22:%22Asia/Shanghai%22,%22utcOffset%22:%22+08:00%22,%22isDst%22:%220%22,%22type%22:%22city%22,%22rank%22:%2225%22,%22fxLink%22:%22http://hfx.link/2b71%22%7D,%7B%22name%22:%22%E5%BB%B6%E5%BA%86%22,%22id%22:%22101010800%22,%22lat%22:%2240.46532%22,%22lon%22:%22115.98500%22,%22adm2%22:%22%E5%8C%97%E4%BA%AC%22,%22adm1%22:%22%E5%8C%97%E4%BA%AC%E5%B8%82%22,%22country%22:%22%E4%B8%AD%E5%9B%BD%22,%22tz%22:%22Asia/Shanghai%22,%22utcOffset%22:%22+08:00%22,%22isDst%22:%220%22,%22type%22:%22city%22,%22rank%22:%2233%22,%22fxLink%22:%22http://hfx.link/2b41%22%7D,%7B%22name%22:%22%E5%B9%B3%E8%B0%B7%22,%22id%22:%22101011500%22,%22lat%22:%2240.14478%22,%22lon%22:%22117.11233%22,%22adm2%22:%22%E5%8C%97%E4%BA%AC%22,%22adm1%22:%22%E5%8C%97%E4%BA%AC%E5%B8%82%22,%22country%22:%22%E4%B8%AD%E5%9B%BD%22,%22tz%22:%22Asia/Shanghai%22,%22utcOffset%22:%22+08:00%22,%22isDst%22:%220%22,%22type%22:%22city%22,%22rank%22:%2233%22,%22fxLink%22:%22http://hfx.link/2bb1%22%7D%5D,%22refer%22:%7B%22sources%22:%5B%22http://qweather.com%22%5D,%22license%22:%5B%22commercial license"]}}

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • 在下月亮有何贵干 前端领域新星创作者 2021-09-01 09:28

    rust?用js不是随便取吗

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题