开启辅助访问 切换到宽版

精易论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

用微信号发送消息登录论坛

新人指南 邀请好友注册 - 我关注人的新帖 教你赚取精币 - 每日签到


求职/招聘- 论坛接单- 开发者大厅

论坛版规 总版规 - 建议/投诉 - 应聘版主 - 精华帖总集 积分说明 - 禁言标准 - 有奖举报

查看: 1865|回复: 5
收起左侧

[完成] 求助用精易json类取下文本

 关闭 [复制链接]
结帖率:75% (15/20)
发表于 2017-10-7 21:34:06 | 显示全部楼层 |阅读模式   江苏省镇江市
10精币
{"btc":{"ticker":{"high":28977,"low":28600,"last":28600,"vol":364.30053,"buy":28600,"sell":28601}},"ltc":{"ticker":{"high":345.98,"low":340.1,"last":340.12,"vol":4882.237686,"buy":340.12,"sell":341.99}},"xpm":{"ticker":{"high":0.99,"low":0.93,"last":0.97,"vol":108386.752602,"buy":0.96,"sell":0.97}},"bec":{"ticker":""},"xrp":{"ticker":{"high":1.6084,"low":1.4904,"last":1.5108,"vol":1951106.578288,"buy":1.5102,"sell":1.513}},"xlm":{"ticker":{"high":0.1588,"low":0.1045,"last":0.137,"vol":63630797.081993,"buy":0.1364,"sell":0.1387}},"bts":{"ticker":{"high":0.4152,"low":0.3936,"last":0.401,"vol":9845367.876731,"buy":0.401,"sell":0.403}},"zcc":{"ticker":{"high":0.122,"low":0.109,"last":0.11,"vol":16071085.653165,"buy":0.109,"sell":0.11}},"mec":{"ticker":""},"ppc":{"ticker":""},"src":{"ticker":""},"tag":{"ticker":""},"dgc":{"ticker":""},"doge":{"ticker":{"high":0.00719,"low":0.00665,"last":0.00681,"vol":370565454.57649,"buy":0.00681,"sell":0.00683}},"ybc":{"ticker":""},"ric":{"ticker":""},"bost":{"ticker":""},"dash":{"ticker":{"high":2080,"low":2010,"last":2021.7,"vol":265.971389,"buy":2021.7,"sell":2038.9}},"nxt":{"ticker":{"high":0.529,"low":0.436,"last":0.497,"vol":11470847.577804,"buy":0.497,"sell":0.504}},"blk":{"ticker":{"high":1.27,"low":1.176,"last":1.18,"vol":192227.50145,"buy":1.18,"sell":1.189}},"vash":{"ticker":{"high":0.052,"low":0.045,"last":0.046,"vol":90758327.779446,"buy":0.046,"sell":0.047}},"eac":{"ticker":""},"xem":{"ticker":{"high":1.4302,"low":1.327,"last":1.388,"vol":410171.002972,"buy":1.3626,"sell":1.388}},"emc":{"ticker":{"high":4.01,"low":3.82,"last":3.95,"vol":25316.812904,"buy":3.95,"sell":4}},"hlb":{"ticker":""},"ncs":{"ticker":{"high":0.0518,"low":0.045,"last":0.0465,"vol":12206264.54452,"buy":0.0447,"sell":0.0465}},"xzc":{"ticker":{"high":78.54,"low":71.32,"last":71.56,"vol":7293.752918,"buy":71.56,"sell":72.97}},"mgc":{"ticker":{"high":0.128,"low":0.11,"last":0.112,"vol":4330374.574,"buy":0.112,"sell":0.114}},"xcn":{"ticker":""},"ardr":{"ticker":{"high":1.119,"low":1.0456,"last":1.078,"vol":1047065.910163,"buy":1.0675,"sell":1.078}},"qrk":{"ticker":""},"wdc":{"ticker":""},"sys":{"ticker":{"high":1.0288,"low":0.9207,"last":1.018,"vol":292119.98173,"buy":1.018,"sell":1.0222}},"anc":{"ticker":""},"med":{"ticker":""},"eth":{"ticker":{"high":2100,"low":1981.1,"last":2020.5,"vol":9353.113879,"buy":2018,"sell":2019.9}},"etc":{"ticker":{"high":82.85,"low":80.5,"last":80.52,"vol":9743.132735,"buy":80.52,"sell":81.19}},"ics":{"ticker":""},"tmc":{"ticker":{"high":4.15,"low":3.93,"last":3.968,"vol":139897.906342,"buy":3.968,"sell":4.023}},"bcc":{"ticker":{"high":2548,"low":2378.3,"last":2420,"vol":904.801298,"buy":2395.1,"sell":2419}},"inf":{"ticker":{"high":0.053,"low":0.048,"last":0.048,"vol":65486690.54587,"buy":0.048,"sell":0.049}}}以上是原JSON文本,想取出每个对象的"HIGH" "LOW" "LAST" "VOL" "BUY" "SELL" 的属性值,求大神帮帮忙

最佳答案

查看完整内容

[e=4].版本 2 .支持库 spec .子程序 _按钮1_被单击 .局部变量 json, 类_json .局部变量 数组, 文本型, , "0" .局部变量 a, 整数型 json.解析 (#常量1) json.取所有属性名 (数组, ) .计次循环首 (取数组成员数 (数组), a) 调试输出 (json.取通用属性 (数组 [a] + “.ticker.high”)) 调试输出 (json.取通用属性 (数组 [a] + “.ticker.low”)) 调试输出 (json.取通用属性 (数组 [a] + “.ticker.last”)) 调试 ...

结帖率:100% (26/26)
发表于 2017-10-7 21:34:07 | 显示全部楼层   天津市天津市
  
子程序名返回值类型公开备 注
_按钮1_被单击  
变量名类 型静态数组备 注
json类_json 
数组文本型0
a整数型 
json.解析 ( #常量1 )
json.取所有属性名 (数组, )
计次循环首 (取数组成员数 (数组), a)
调试输出 (json.取通用属性 (数组 [a]“.ticker.high”))
调试输出 (json.取通用属性 (数组 [a]“.ticker.low”))
调试输出 (json.取通用属性 (数组 [a]“.ticker.last”))
调试输出 (json.取通用属性 (数组 [a]“.ticker.vol”))
调试输出 (json.取通用属性 (数组 [a]“.ticker.buy”))
调试输出 (json.取通用属性 (数组 [a]“.ticker.sell”))
计次循环尾 ()


i支持库列表   支持库注释   
spec特殊功能支持库

评分

参与人数 2好评 +2 精币 +7 收起 理由
戒卜掉思恋 + 1 + 5 哈哈 写得一模一样
待删用户 + 1 + 2 新技能已get√

查看全部评分

回复

使用道具 举报

结帖率:100% (2/2)
发表于 2017-10-7 21:46:27 | 显示全部楼层   江苏省徐州市
正则更方便         

01.e

646.19 KB, 下载次数: 8, 下载积分: 精币 -1 枚

点评

json其实用惯了其实比正则表达式更强大,正则表达式实用于没有语法规则的文本。   四川省成都市  发表于 2017-10-7 21:57

评分

参与人数 1好评 +1 精币 +1 收起 理由
易正易则 + 1 + 1 欢迎常来帮助新人,谢谢~

查看全部评分

回复

使用道具 举报

结帖率:94% (93/99)
发表于 2017-10-7 21:52:18 | 显示全部楼层   四川省成都市

[e]
.版本 2
.支持库 spec

.程序集 窗口程序集_启动窗口

.子程序 __启动窗口_创建完毕
.局部变量 JSON, 类_json
.局部变量 局部_成员数, 整数型
.局部变量 局部_数组, 文本型, , "0"
.局部变量 局部_记次, 整数型

JSON.解析 (#常量_json)
JSON.取所有属性名 (局部_数组)
局部_成员数 = 取数组成员数 (局部_数组)
.计次循环首 (局部_成员数, 局部_记次)
    .如果真 (JSON.成员数 (局部_数组 [局部_记次] + “.ticker”) ≤ 1)
        到循环尾 ()
    .如果真结束
    调试输出 (“high:” + JSON.取通用属性 (局部_数组 [局部_记次] + “.ticker.high”, ))
    调试输出 (“low:” + JSON.取通用属性 (局部_数组 [局部_记次] + “.ticker.low”, ))
    调试输出 (“last:” + JSON.取通用属性 (局部_数组 [局部_记次] + “.ticker.last”, ))
    调试输出 (“vol:” + JSON.取通用属性 (局部_数组 [局部_记次] + “.ticker.vol”, ))
    调试输出 (“buy:” + JSON.取通用属性 (局部_数组 [局部_记次] + “.ticker.buy”, ))
    调试输出 (“sell:” + JSON.取通用属性 (局部_数组 [局部_记次] + “.ticker.sell”, ))
    调试输出 (“--------------------------------------------------------------------”)
.计次循环尾 ()



[/e]
TIM截图20171007215104.png

评分

参与人数 2好评 +2 精币 +3 收起 理由
易正易则 + 1 + 1 欢迎常来帮助新人,谢谢~
待删用户 + 1 + 2 json不熟悉,正则会一点

查看全部评分

回复

使用道具 举报

结帖率:0% (0/1)

签到天数: 14 天

发表于 2017-12-19 03:15:44 高大上手机用户 | 显示全部楼层   山东省菏泽市
json的为什么用正则?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 致发广告者

发布主题 收藏帖子 返回列表

sitemap| 易语言源码| 易语言教程| 易语言论坛| 易语言模块| 手机版| 广告投放| 精易论坛
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论,本站内容均为会员发表,并不代表精易立场!
论坛帖子内容仅用于技术交流学习和研究的目的,严禁用于非法目的,否则造成一切后果自负!如帖子内容侵害到你的权益,请联系我们!
防范网络诈骗,远离网络犯罪 违法和不良信息举报电话0663-3422125,QQ: 793400750,邮箱:wp@125.la
Powered by Discuz! X3.4 揭阳市揭东区精易科技有限公司 ( 粤ICP备12094385号-1) 粤公网安备 44522102000125 增值电信业务经营许可证 粤B2-20192173

快速回复 返回顶部 返回列表