zoukankan      html  css  js  c++  java
  • jsonpath

    1. java 类库

         jayway/JsonPath 

          maven 使用方法

    <dependency>
        <groupId>com.jayway.jsonpath</groupId>
        <artifactId>json-path</artifactId>
        <version>2.2.0</version>
    </dependency>
    

      jsonpath 语法:

          

    Operators

    OperatorDescription
    $ The root element to query. This starts all path expressions.
    @ The current node being processed by a filter predicate.
    * Wildcard. Available anywhere a name or numeric are required.
    .. Deep scan. Available anywhere a name is required.
    .<name> Dot-notated child
    ['<name>' (, '<name>')] Bracket-notated child or children
    [<number> (, <number>)] Array index or indexes
    [start:end] Array slice operator
    [?(<expression>)] Filter expression. Expression must evaluate to a boolean value.

    2. js 类库

          jsonpath-plus  

          npm    

          

    npm install jsonpath-plus
    

       使用 nodeJs  broswer

       

     var JSONPath = require('jsonpath-plus');
      var result = JSONPath({json: obj, path: path});
    

      

    <script src="lib/jsonpath.js"></script> 
      <script>
          var result = JSONPath({path: path, json: obj});
      </script> 
    

      

      

        

  • 相关阅读:
    css之布局
    css之浮动
    白扯之聊聊我们的情怀
    Vue之指令
    Vue之vue.js声明式渲染
    AJAX经常遇到的那些问题
    HTTP之cookie技术
    正则表达式资料
    require.js资料
    AMD 和 CMD 的区别
  • 原文地址:https://www.cnblogs.com/rongfengliang/p/5938491.html
Copyright © 2011-2022 走看看