I am trying to design a JSON object that would work with Jersey and Jackson.
Am fairly new to JSON / Restful programming, so I am wondering if the following is viable.
{
"name": "myservice",
"orders": [
{
"name": "iphone",
"description": "iPhone 5",
"providers": [
{
"name": "a",
"description": "AT&T",
"pricing": ["$40", "$70", "$120"]
},
{
"name": "b",
"description": "Verizon",
"pricing": ["$45", "$60", "$85"]
}
]
},
{
"name": "galaxy3",
"description": "Samsung Galaxy 3",
"providers": [
{
"name": "a",
"description": "AT&T",
"pricing": ["$45", "$60", "$85"]
}
]
}
]
}
Get all information regarding iPhone's Verizon provider:
curl GET -H'Content-Type: application/json' https://mydomain/myservice/iphone/b
would return:
{
"name": "b",
"description": "Verizon",
"pricing": ["$45", "$60", "$85"]
}
Get list of pricing for iPhone's AT&T provider:
curl GET -H'Content-Type: application/json' https://mydomain/myservice/iphone/a?pricing
Would return:
{
["$40", "$70", "$120"]
}
Any examples or feedback will be greatly appreciated!