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

怎么用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条回答

      报告相同问题?

      相关推荐 更多相似问题

      问题事件

      • 创建了问题 8月31日

      悬赏问题

      • ¥15 这段有什么bug 为什么总报错
      • ¥15 关于#php#根据url判断选择加载模板应该如何解决?会的速来捡钱!
      • ¥15 Intel Realsense深度相机(D415/D435)拍摄梯子获取梯子点云
      • ¥50 unity使用easyar录屏更换视频保存路径
      • ¥15 CECGameSession::OutputLinkSevError(iRetCode=4) LINK超时
      • ¥20 出错 textread (第 124 行) [varargout{1:nlhs}]=dataread('file',varargin{:}); %#ok<REMFF1>
      • ¥15 tensor flow目标检测环境配置问题
      • ¥15 数据库float型转换精度问题
      • ¥15 运行您代码时出现报错,如何解决?(标签-回归|关键词-无法识别)
      • ¥50 android service弹出dialog,showdialog就出错,如何解决?