Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.1
    • Fix Version/s: None
    • Labels:
      None

      Description

      I received feedback that JSON-P should add support for being able to query JSON objects (a la XPath). I am aware that this is an immature field with some competing approaches but think this is very valid feedback particularly in making JSON-P more compelling vis-à-vis existing JSON processing solutions.

      Do let me know if anything needs to be explained further - I am happy to help.

      Please note that these are purely my personal views and certainly not of Oracle's as a company.

        Activity

        Hide
        mitemitreski added a comment -

        Would filtering or transformations using JSON pointer make sense?

        Show
        mitemitreski added a comment - Would filtering or transformations using JSON pointer make sense?
        Hide
        kchung added a comment - - edited

        There is currently no standard for JSON queries, so it would be premature to put query into JSON APIs.

        Since JsonObject is a Map, and JsonArray a List, some querying should be possible using the Lambda expression in JDK 8. For instance,

          contacts.stream()
            .filter(p->p.getString("city").equals("Santa Clara"))
            .forEach(p->System.out.println(p.getString("firstName") + " " + p.getString("lastName"));)
        

        would print out the names of your contacts residing in Santa Clara. With a little more work, it should be possible to return a JSON document of the query results.

        Maybe the spec should look into providing better support for doing queries in Lambda?

        Show
        kchung added a comment - - edited There is currently no standard for JSON queries, so it would be premature to put query into JSON APIs. Since JsonObject is a Map, and JsonArray a List, some querying should be possible using the Lambda expression in JDK 8. For instance, contacts.stream() .filter(p->p.getString( "city" ).equals( "Santa Clara" )) .forEach(p-> System .out.println(p.getString( "firstName" ) + " " + p.getString( "lastName" ));) would print out the names of your contacts residing in Santa Clara. With a little more work, it should be possible to return a JSON document of the query results. Maybe the spec should look into providing better support for doing queries in Lambda?

          People

          • Assignee:
            Unassigned
            Reporter:
            reza_rahman
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: