If I have a JSON file
{
"firstName": "John",
"lastName": "Smith",
"age": 25,
"address":
{
"streetAddress": "21 2nd Street",
"city": "New York",
"state": "NY",
"postalCode": "10021"
},
"phoneNumber":
[
{
"type": "home",
"number": "212 555-1234"
},
{
"type": "fax",
"number": "646 555-4567"
}
]
}
, I want to use the serializer. I understand that I need to create a class that fits the JSON categories.
So I created this:
class Person
{
public String firstName;
public String lastName;
public String age;
public class address
{
public String streetAddress;
public String city;
public String state;
public String postalCode;
}
public class phoneNumber
{
public String type;
public String number;
}
}
It works fine with age and name but not with address and phoneNumber(I din't know how to creat them in the class file). I hope you can help me.