utahiosmac / Marshal

Marshaling the typeless wild west of [String: Any]
MIT License
697 stars 62 forks source link

Question about deserializing #112

Open beraybentesen opened 7 years ago

beraybentesen commented 7 years ago

Hi,

I'm trying to parse json response like this but nothing happens. Any suggestion ?

screen shot 2017-06-06 at 1 51 09 am

Thanks

ttuygun commented 7 years ago

Hmm. It supposed to parse it. Can you send the example JSON?

beraybentesen commented 7 years ago

@ttuygun Example response for 1 item :

{ "PropertiesResponse": { "Properties": [ { "id": 2289, "is_passive": 0, "lead_id": null, "agent_id": 3302, "contact_first_name": “Name”, "contact_last_name": “LastName”, "is_office_page_property": 1, "user_listing_url_type": 1, "is_shareable": 1, "category_id": 1, "status": 2, "type": 1, "price": 5700000, "price_currency": 1, "ad_type": 1, "latitude": 10.000000000, "longitude": 100000000000, "area": 245, "room": 4, "saloon_count": 1, "age": 0, "floor": 14, "total_floor": 15, "district_id": 1111111111, "source_property_id": 1111111111, "url": “url”, "title": “Title”, "description": “Description”, "User": { "id": 3302, "folder_path": “folder_path”, "file_name": “file_name.jpg" }, "County": { "name": "Kadıköy" }, "District": { "name": "Fenerbahçe Mah." }, "Lead": { "is_passive": null }, "PropertyImage": { "folder_path": “folder_path”, "file_name": “file_name.jpg" }, "ReferenceProperty": { "reference_property_id": null }, "Prices": { "price": { "dollar": { "symbol": "$", "price": 1600718 }, "euro": { "symbol": "€", "price": 1409530 }, "pound": { "symbol": "£", "price": 1235156 }, "turkish_lira": { "symbol": "TL", "price": 5700000 } }, "m2Price": { "dollar": { "symbol": "$", "price": 6533 }, "euro": { "symbol": "€", "price": 5753 }, "pound": { "symbol": "£", "price": 5041 }, "turkish_lira": { "symbol": "TL", "price": 23265 } } }, "PropertyStats": { "similarLeads": 0, "similarProperties": 0, "similarOfficeProperties": 0, "eligibleCustomers": 0, "totalSimilarListings": 0 }, "Options": { "type": "Daire ", "price_currency": "Türk Lirası ", "age": "Sıfır ", "floor": "14 ", "total_floor": "15 ", "status": “Status”, "ad_type": “ad_type” } } ], "Pagination": { "page": 1, "count": 38, "pageCount": 38 }, "Return": { "Status": "OK", "UserId": 3302, "OfficeId": 84, "Message": "Properties Found" } } }

ttuygun commented 7 years ago

Can you also upload parser models?

beraybentesen commented 7 years ago

I don't have any code unfortunately. I just followed guide for a few key not for all key in response. No exception, no error nothing happened.

ttuygun commented 7 years ago

Your quotes is not correct in the response of the JSON. Is this issue because of sever or your copy paste mistake? Could you test your JSON in any JSON validation site?

beraybentesen commented 7 years ago

It was my mistake. Here is the correct one, thank you.

{ "PropertiesResponse": { "Properties": [ { "id": 2289, "is_passive": 0, "lead_id": null, "agent_id": 3302, "contact_first_name": "name", "contact_last_name": "last_name", "is_office_page_property": 1, "user_listing_url_type": 1, "is_shareable": 1, "category_id": 1, "status": 2, "type": 1, "price": 5700000, "price_currency": 1, "ad_type": 1, "latitude": 40.971476352484849, "longitude": 29.046548008918759, "area": 245, "room": 4, "saloon_count": 1, "age": 0, "floor": 14, "total_floor": 15, "district_id": 13402005007, "source_property_id": 376277648, "url": "url", "title": "Title", "description": "Desc...", "User": { "id": 3302, "folder_path": "path", "file_name": "5942c2368d4f7.jpg" }, "County": { "name": "Kadıköy" }, "District": { "name": "Fenerbahçe Mah." }, "Lead": { "is_passive": null }, "PropertyImage": { "folder_path": "path", "file_name": "sah_593fe53daf625.jpg" }, "ReferenceProperty": { "reference_property_id": null }, "Prices": { "price": { "dollar": { "symbol": "$", "price": 1587434 }, "euro": { "symbol": "€", "price": 1399769 }, "pound": { "symbol": "£", "price": 1227125 }, "turkish_lira": { "symbol": "TL", "price": 5700000 } }, "m2Price": { "dollar": { "symbol": "$", "price": 6479 }, "euro": { "symbol": "€", "price": 5713 }, "pound": { "symbol": "£", "price": 5008 }, "turkish_lira": { "symbol": "TL", "price": 23265 } } }, "PropertyStats": { "similarLeads": 0, "similarProperties": 0, "similarOfficeProperties": 0, "eligibleCustomers": 0, "totalSimilarListings": 0 }, "Options": { "type": "Daire ", "price_currency": "Türk Lirası ", "age": "Sıfır ", "floor": "14 ", "total_floor": "15 ", "status": "Satılık ", "ad_type": "ad" } } ], "Pagination": { "page": 1, "count": 38, "pageCount": 38 }, "Return": { "Status": "OK", "UserId": 3302, "OfficeId": 84, "Message": "Properties Found" } } }