Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: JSONPath
    • Labels:
      None

      Description

      Add components supporting JsonPath [1] + [2], possibly similar to what we have for XPath

      [1] http://goessner.net/articles/JsonPath/
      [2] http://code.google.com/p/json-path/

        Issue Links

          Activity

          Hide
          Artem Bilan added a comment -

          So, I think it is an umbrella issue and I agree to have a set of components similar to SI-XPath components.
          In additional it may be interestingly to introduce two new transformers:
          <json-to-xml-transformer>
          <xml-to-json-transformer>
          But it is exactly out of scope of this issue...
          I'm not sure which implementation of JSONPath should we use or we should implement our own...
          How about this one: https://github.com/beckchr/staxon/wiki ?

          Regarding JSONPath ability inside the SpEL: we can achieve it via StandardEvaluationContext#registerFunction(), so in the end it will look like this:

          expression="#json(payload.jsonProp, '//foo/bar[0]')"
          

          When we will register some static method from potential JsonPathFactory on each EvaluationContext creating.
          But then we should move this new module to the Spring Integration project.

          And as I see we may do the same for XPath right now.
          But it isn't trivial now: there are a lot of direct EvaluationContext creating bypassing ExpressionUtils...
          And also maybe it is in the scope of the task: https://jira.springsource.org/browse/INT-1639

          Cheers

          Show
          Artem Bilan added a comment - So, I think it is an umbrella issue and I agree to have a set of components similar to SI-XPath components. In additional it may be interestingly to introduce two new transformers: <json-to-xml-transformer> <xml-to-json-transformer> But it is exactly out of scope of this issue... I'm not sure which implementation of JSONPath should we use or we should implement our own... How about this one: https://github.com/beckchr/staxon/wiki ? Regarding JSONPath ability inside the SpEL: we can achieve it via StandardEvaluationContext#registerFunction() , so in the end it will look like this: expression= "#json(payload.jsonProp, ' //foo/bar[0]')" When we will register some static method from potential JsonPathFactory on each EvaluationContext creating. But then we should move this new module to the Spring Integration project. And as I see we may do the same for XPath right now. But it isn't trivial now: there are a lot of direct EvaluationContext creating bypassing ExpressionUtils ... And also maybe it is in the scope of the task: https://jira.springsource.org/browse/INT-1639 Cheers
          Hide
          Mark Pollack added a comment -

          http://code.google.com/p/json-path/ is what is used for jsonpath support in spring framework's MVC test support, so i suggest we go with that.

          Show
          Mark Pollack added a comment - http://code.google.com/p/json-path/ is what is used for jsonpath support in spring framework's MVC test support, so i suggest we go with that.
          Hide
          Mark Pollack added a comment -

          There would be json-path-transformer, json-path-router, and json-path-filter components.

          The dedicated namespace for those would likely be the preferred way to use it, though the use inside spel is also interesting, An case could be made to do the same with Spel and the XML support. I don't know if 'having more than one way to do it' helps or hurts in this case.

          Show
          Mark Pollack added a comment - There would be json-path-transformer, json-path-router, and json-path-filter components. The dedicated namespace for those would likely be the preferred way to use it, though the use inside spel is also interesting, An case could be made to do the same with Spel and the XML support. I don't know if 'having more than one way to do it' helps or hurts in this case.
          Hide
          Artem Bilan added a comment -

          Well, after some investigation jsonPath looks very simple and easy to use.
          I'll push to SI out-of-the-box SpEL #jsonPath() function soon.
          See the linked issue.
          Thank you, Mark Pollack

          Show
          Artem Bilan added a comment - Well, after some investigation jsonPath looks very simple and easy to use. I'll push to SI out-of-the-box SpEL #jsonPath() function soon. See the linked issue. Thank you, Mark Pollack
          Hide
          Artem Bilan added a comment -

          See PR from linked issue

          Show
          Artem Bilan added a comment - See PR from linked issue
          Hide
          Artem Bilan added a comment -

          In favor of existing #jsonPath SpEL-function from core.

          Show
          Artem Bilan added a comment - In favor of existing #jsonPath SpEL-function from core.

            People

            • Assignee:
              Artem Bilan
              Reporter:
              Gunnar Hillert
            • Votes:
              3 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: