Translating JSON/API Results
-
I’m hoping that someone has had to do what I’m attempting to do and knows of a WP plugin or even 3rd party solution. I’m using the GeoDirectory plugin and trying to connect their recently released API to a mobile development framework that supports custom JSON feeds. The issue is that the GeoDirectory API formatting is different than what the mobile framework needs to parse. I’ve included a cleaned up example of what GeoDirectory produces and what the mobile development framework expects. I’m essentially looking to take the input, modify it, and re-output it in the correct format in realtime. Thanks for any help anyone can provide.
GeoDirectory Output:
[ { "id": $id, "date": "$date", "date_gmt": "$date_gmt", "guid": { "rendered": "$guid" }, "modified": "$modified", "modified_gmt": "$modified_gmt", "slug": "$slug", "type": "$type", "link": "$link", "title": { "rendered": "$title" }, "content": { "rendered": "$content" }, "excerpt": { "rendered": "$excerpt" }, "gd_data": { "post_id": "$post_id", "post_title": "$post_title", "post_status": "$post_status", "default_category": { "raw": "$default_category_raw", "rendered": "$default_category_rendered" }, "claimed": "$claimed", "is_featured": "$is_featured", "featured_image": "$featured_image", "post_address": "$post_address", "post_city": "$post_city", "post_region": "$post_region", "post_country": "$post_country", "post_zip": "$post_zip", "post_latitude": "$post_latitude", "post_longitude": "$post_longitude", "geodir_contact": "$geodir_contact", "geodir_email": "$geodir_email", "geodir_website": "$geodir_website", "geodir_twitter": "$geodir_twitter", "geodir_facebook": "$geodir_facebook", "geodir_special_offers": "$geodir_special_offers", } ]
Mobile Framework Supported:
{ "dedup": true, "generated_in": "0.010000 s", "items": [ { "address": "$post_address", "author": "", "commentsEnabled": false, "content": "$content", "contentTemplate": null, "date": "$date", "email": "$geodir_email", "id": $post_id, "images": [ { "id": "$post_id", "url": "$featured_image" } ], "isFeatured": "$is_featured", "latitude": "$post_latitude", "longitude": "$post_longitude", "phoneNumber": "$geodir_contact", "subsections": { "$default_category_raw": [ "$default_category_rendered" ] }, "subtype": "mcms", "summary": "$excerpt", "title": "$post_title", "type": "maps", "website": "$geodir_website" } ], "next_page": null, "stat": "ok" }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Translating JSON/API Results’ is closed to new replies.