Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8058416

JSON in Java lanaguage

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 8u20
    • core-libs
    • x86_64
    • windows_7

      A DESCRIPTION OF THE REQUEST :
      As usual Java evolves and improves from time to time. I think following feature would be great for future releases of Java

      Ability to pass data in Json format (like java-script) for functions accepting map (and if possible for beans also)

      Giving example is expected behavior

      JUSTIFICATION :
      This will make code more simpler, instead of building map we can directly pass json object.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Say we have method like

            void process(String name, Map<String, Integer> map)

      While invoking this method it would be great to have language feature like

         process("Some name", {
               "key1": 10,
               "key2": 20
         });

      The keys should be validated based on compile time signature of method.

      Similarly it would be great to pass JSON for standard java objects also. Which should use default constructor for initialization. This way the API developer need not worry about giving all the possible or useful constructors. The values may be set using setter/getters.



            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: