AndrewNatoli / PHP-RapidREST

Have a complete CRUD API to prototype your new application in under sixty seconds.
http://AndrewNatoli.com
MIT License
5 stars 4 forks source link

Support nested JSON data #2

Open AndrewNatoli opened 8 years ago

AndrewNatoli commented 8 years ago

Goal is to convert RapidREST to support nested JSON data like this:

POST /bagel

{
    "name": "Fresh",
    "friends": [
        {
            "name": "Also"
        },
        {
            "name": "Alonso",
            "fudge": "Biscuit",
            "eggs": [
                {
                    "fresh": "yay",
                    "delicious": "nay"
                }
            ]
        }
    ]
}

pardon the crazy example 🙃

AndrewNatoli commented 8 years ago

Note that the "friends" list gets converted to "ownFriends" on the PHP-side. Goes in as the "friends" table, but comes back out as an "ownFriends" array.

On GET, need to run through elements, check if those starting with "own" are associative arrays or sequential. If the latter, strip the "own" from the start.