Loading ...
Sorry, an error occurred while loading the content.

421Re: [json] JAVA: Merging JSONObject's and JSONArray's

Expand Messages
  • Fang Yidong
    Jun 20, 2006
    • 0 Attachment
      In org.json.simple, a JSONArray is a List and a
      JSONObject is a Map,so you can use
      List.addAll(JSONArray) or Map.addAll(JSONObject) to
      merge them.

      --- Greg Patnude <gpatnude@...>:

      >
      > I have identified a need to merge/mangle several
      > discrete JSON objects
      > into a single JSON object in Java.
      >
      > Has anyone ever developed a method to merge two
      > JSONArray's or two
      > JSONObject's into a single JSONObject or JSONArray
      > in Java ???
      >
      > I am seeking Array->merge(JSONArray1, JSONArray2)
      > and
      > Object->merge(JSONObject1, JSONObject2)
      > functionality... I am not
      > looking for append.. there's already plenty of that
      > built into the core
      > JSON...
      >
      > Note: This is NOT the same as
      > JSONObject.accumulate(key, val) or
      > JSONArray.put(val)...
      >
      > Any ideas anyone ?
      >
      >
      >
      >
      >
      >



      --
      JSON: Action in AJAX!

      JSON - http://www.json.org
      JSON.simple - http://www.json.org/java/simple.txt







      ___________________________________________________________
      Mp3疯狂搜-新歌热歌高速下
      http://music.yahoo.com.cn/?source=mail_mailbox_footer
    • Show all 2 messages in this topic