EDIT: Something like this, but this is not working either, but there is the problem I think
var stringifyObj = JSON.stringify({
"addressAddressId":$('#address').val(){
"cityId:"$('#city').val(){
"postalCode":$('#postalCode').val()
}
}
});
*When I generate test client in Netbeans, JSON-structure (GET/JSON) is like that, but how can I code that with Javascipt and Strinfy-function? *
"addressAddressId": {
"addressId": 1,
"address": "Järnvägen 2",
"address2": null,
"district": null,
"postalCode": "20360",
"phone": null,
"coordinates": null,
"latitude": null,
"longitude": null,
"directions": null,
"description": null,
"addrZipCityCountry": null,
"lastUpdated": 1361754860000,
"cityId": {
"cityId": 1,
"city": "",
"lastUpdate": 1361754850000,
"countryCountryId": {
"countryId": 1,
"country": "Sweden",
"lastUpdate": 1361754837000
}
}
},
QUESTION
- What is the correct syntax when using JSON.stringify in case of own object type like City-object inside of Address-object?
- Should I add every field to json if not using @JsonIgnoreProperties({""})? I just need address, city and postal code. address is type of Address with field String address in server side, City is type of City includes String-field for city name etc.