Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-10966

JSON entity data import and export utility

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Reopened
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • framework
    • None

    Description

      Currently, we support import/export entity data in XML format.
      Nowadays JSON is widely used in industry, we can have support for JSON format which looks quite similar to XML support.

      Here is example of XML data and it's JSON version

      <Party partyId="123456" partyTypeId="PERSON" statusId="PARTY_ENABLED"/>
      
      {“Party”: {"partyId":"123456","partyTypeId":"PERSON","statusId":"PARTY_ENABLED”}}
      

       

      Design Proposal

      We can write entityImportJson and entityImportDirJson services for importing JSON from screen and directory respectively.

      And the entityExportAllJson service for exporting entity data in JSON.

       

      Import Design
      The import service will perform following operations:
      1.) Validate the input JSON data (I am in process of exploring the way for this)
      2.) On successful validation, convert JSON to OFBiz's entity model (GenericValue)
      3.) The GenericValue will be inserted in database by some handler class for e.g we can write JsonDataHandler, it will convert given JSON to List<GenericValue>, and finally write it to database (Similar pattern is used in XML import).

       

      Export Design
      Based on existing XML pattern the writeXmlText method of GenericEntity class write the exported data in XML format.
      In the similar way, we can implement writeJsonText to export data in JSON format.

      Please free feel to share your thought.

      Attachments

        1. OFBiz-Web-Tools-JSON-Data-Import-Dir.png
          205 kB
          Jayansh Shinde
        2. OFBiz-Web-Tools-JSON-Data-Export-All.png
          201 kB
          Jayansh Shinde
        3. OFBiz-10966.patch
          54 kB
          Jayansh Shinde
        4. OFBIZ-10966_27062019.patch
          146 kB
          Jayansh Shinde
        5. importJson.png
          220 kB
          Jayansh Shinde
        6. exportJson.png
          285 kB
          Jayansh Shinde

        Activity

          People

            jayansh Jayansh Shinde
            jayansh Jayansh Shinde
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated: