码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • 经典JsonPath表达式


    1、按照时间过滤,过滤 晚22点至01点之间的数据

    Jayway JsonPath evaluator

    测试数据:

    示例1:

    1. {
    2. "store": {
    3. "book": [
    4. {
    5. "category": "fiction",
    6. "time": "2022-10-01 21:10:01",
    7. "title": "Sword of Honour",
    8. "price": 12.99
    9. },
    10. {
    11. "category": "fiction",
    12. "time": "2022-10-01 22:10:01",
    13. "title": "Sword of Honour",
    14. "price": 12.99
    15. },
    16. {
    17. "category": "fiction",
    18. "time": "2022-10-01 23:10:01",
    19. "title": "Moby Dick",
    20. "isbn": "0-553-21311-3",
    21. "price": 8.99
    22. },
    23. {
    24. "category": "fiction",
    25. "time": "2022-10-01 00:10:01",
    26. "title": "The Lord of the Rings",
    27. "isbn": "0-395-19395-8",
    28. "price": 22.99
    29. },
    30. {
    31. "category": "fiction",
    32. "time": "2022-10-01 01:10:01",
    33. "title": "The Lord of the Rings",
    34. "isbn": "0-395-19395-8",
    35. "price": 22.99
    36. },
    37. {
    38. "category": "fiction",
    39. "time": "2022-10-01 02:10:01",
    40. "title": "The Lord of the Rings",
    41. "isbn": "0-395-19395-8",
    42. "price": 22.99
    43. },
    44. {
    45. "category": "fiction",
    46. "time": "2022-10-01 03:10:01",
    47. "title": "The Lord of the Rings",
    48. "isbn": "0-395-19395-8",
    49. "price": 22.99
    50. }
    51. ],
    52. "bicycle": {
    53. "color": "red",
    54. "price": 19.95
    55. }
    56. },
    57. "expensive": 10
    58. }

    JsonPath 表达式:

    $..book[?(@.time =~ /.* 22:.*|.* 23:.*|.* 00:.*|.* 01:.*/i)]

    返回结果:

    实例2:

    测试数据:

    1. {
    2. "category": "fiction",
    3. "time": "2022-10-01 03:10:01",
    4. "title": "The Lord of the Rings",
    5. "isbn": "0-395-19395-8",
    6. "price": 22.99
    7. }

     JsonPath 表达式:

    $[?( @.time=~ /.* 22:.*|.* 23:.*|.* 00:.*|.* 01:.*/i)]

    测试结果:

  • 相关阅读:
    VMware Workstation环境下,DHCP服务的安装配置,用ubuntu来测试
    “牛市陷阱?还是回调?是好?还是坏!“
    C++编程规范(一)
    股票量化交易系统的指标和策略有哪些?
    .NET Entity FrameWork 总结 ,在项目中用处个人感觉不大。适合初级用用,不涉及到与数据库通信。
    MySQL:02-增删改查
    Android开发中System.currentTimeMillis()与SystemClock.uptimeMillis()
    数字孪生智慧工厂3D无代码编辑工具提供强大、简单功能
    openwrt使用教程
    成长一夏 挑战赛来袭 专属社区福利来袭~免费获得CSDN定制T恤衫
  • 原文地址:https://blog.csdn.net/shaokai132333/article/details/126651201
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号