0

I have a JSON structure where I want to change the order in the Array.

{"data": [
    {
        "ERP": 0080001,
        "Issuedate": 20181102,
        "Shippingpoint": 503,
        "Shiptoparty": 0088000,
        "products": [
            {
                "QTY": 0.000,
                "SKUno": 000000000011000077,
                "Unit": "L" 
            },
            {
                "QTY": 0.000,
                "SKUno": 000000000011000078,
                "Unit": "L"
            }
        ]
    }
]}

I want SKUno first in array then QTY and then Unit.

                 "SKUno": 000000000011000078,
                 "QTY": 0.000,
                 "Unit": "L"

How to rearrange this using Java?

Kaushik
  • 155
  • 1
  • 2
  • 17
  • Possible duplicate of [Jackson ObjectMapper - specify serialization order of object properties](https://stackoverflow.com/questions/27577701/jackson-objectmapper-specify-serialization-order-of-object-properties) – lakshman Sep 19 '19 at 11:48
  • Do you want to read this `JSON`, deserialise it to `POJO`, rearrange order of names in object and serialise it back to `JSON`? Or maybe you already have a `POJO` and just want to change an order of properties? Order of properties in `JSON` does not matter and you do not need to do that. – Michał Ziober Sep 19 '19 at 12:37
  • I had xml which I converted into JSON but since JSON rearranges the values present in arrays, I wanted to know is there way we can prevent the insertion order pre conversion or can we change the order post the conversion? – Kaushik Sep 19 '19 at 12:45

0 Answers0