Dataframe columns are ordered alphabetically when you print the dataframe

`import Cocoa
import TabularData

let greeting = "Decimal Type Evaluation"

let JSON = """
[{
    "product": "Apple",
    "type": "Fruit",
    "weight": 7.5,
    "unit_price": 0.34
},
{
    "product": "Pear",
    "type": "Fruit",
    "weight": 0.5,
    "unit_price": 0.25
}]
"""

struct Product: Decodable {
    let product: String
    let type: String
    let weight: Double
    let unit_price: Double
}

let jsonData = JSON.data(using: .utf8)!

let products: [Product] = try! JSONDecoder().decode([Product].self, from: jsonData)

var dataframe = try! DataFrame(jsonData: jsonData)

print (dataframe)`

This results in the output below showing the columns are now ordered alphabetically and not in the order they appear in the array struct definition.

┏━━━┳━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━┓
┃   ┃ product  ┃ type     ┃ unit_price ┃ weight   ┃
┃   ┃ <String> ┃ <String> ┃ <Double>   ┃ <Double> ┃
┡━━━╇━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━┩
│ 0 │ Apple    │ Fruit    │       0.34 │      7.5 │
│ 1 │ Pear     │ Fruit    │       0.25 │      0.5 │
└───┴──────────┴──────────┴────────────┴──────────┘
2 rows, 4 columns

JSON keys are not order-preserving. You could potentially have a different order for each element of the array. This is intended behaviour.

Dataframe columns are ordered alphabetically when you print the dataframe
 
 
Q