samedi 6 décembre 2014

Array inside a json object and object inside a json object using php


Vote count:

0




I am trying to produce the following json from mysql database using php. How do i go about doing it in php lets say using the explode function for getting the array into the json object. I dont know about getting the json object inside an object. I just need to seperate php files to achive the following.




  1. Array inside a json object


    [ { "firstName":"John", "lastName":"Doe", "images": ['image1','image2','image3'] }, { "firstName":"Anna",

    "lastName":"Smith", "images": ['image1','image2','image3'] }, { "firstName":"Peter", "lastName":"Jones", "images": ['image1','image2','image3'] } ]




  2. json object inside an object


    [ { "firstName":"John", "lastName":"Doe", "cover": { "cover_id": "0858699703", "source": "http://ift.tt/1FZLqe0", "offset_y": "0" } }, { "firstName":"Anna",

    "lastName":"Smith" "cover": { "cover_id": "0858699703", "source": "http://ift.tt/1FZLqe0", "offset_y": "0" } }, { "firstName":"Peter", "lastName":"Jones" "cover": { "cover_id": "0858699703", "source": "http://ift.tt/1FZLqe0", "offset_y": "0" } } ]





asked 28 secs ago







Array inside a json object and object inside a json object using php

Aucun commentaire:

Enregistrer un commentaire