Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7809151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:20:10+00:00 2026-06-02T03:20:10+00:00

Okay I’m attempting to use php to encode a json file I’m subsequently using

  • 0

Okay I’m attempting to use php to encode a json file I’m subsequently using to draw a map with the Polymaps service.

I’m having trouble when encoding my json from the Instagram API — I’m able to do it, but I need the structure to be nested in this certain way. My code I have now encodes it in this format:

[
 {
  "title":"some value",
  "src":"some value",
  "lat":"some value",
  "lon":"some value"
},
...

So on and so forth. I need the format to match something more like this:

{
"type":"FeatureCollection",
"features":[

  {
     "type":"Feature",
     "geometry":{
        "coordinates":[
           -94.34885,
           39.35757
        ],
        "type":"Point"
     },
     "properties":{
        "latitude":39.35757,
        "title":"Kearney",
        "id":919,
        "description":"I REALLY need new #converse, lol. I've had these for three years. So #destroyed ! :( Oh well. Can't wait to get a new pair and put my #rainbow laces through. #gay #gaypride #bi #proud #pride #colors #shoes #allstar #supporting ",
        "longitude":-94.34885,
        "user":"trena1echo5",
        "image":"http://images.instagram.com/media/2011/09/09/ddeb9bb508c94f2b8ff848a2d2cd3ece_7.jpg",
        "instagram_id":211443415
     }
  },
  {
     "type":"Feature",
     "geometry":{
        "coordinates":[
           -0.09402781,
           51.51512
        ],
        "type":"Point"
     },
     "properties":{
        "latitude":51.51512,
        "title":"City Of London",
        "id":918,
        "description":"#destroyed",
        "longitude":-0.09402781,
        "user":"axxoul",
        "image":"http://distillery.s3.amazonaws.com/media/2011/09/09/ffda47fb97924a41bc36b0b024fcdfad_7.jpg",
        "instagram_id":211074717
     }
  },

…with its nested structure. I have the jquery working to read from the json file and the php script written to make the json…this is the last puzzle piece for me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T03:20:11+00:00Added an answer on June 2, 2026 at 3:20 am

    Instead of attempting to manipulate your JSON data with PHP, you could always use PHP’s json_decode() function to convert your JSON into a PHP array.

    Once you have your data in an easier format to deal with, you can make all the changes you require to the data using PHP’s array functions and once you are done you can encode it back to a JSON with PHP’s json_encode.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, so I've done a bit of research into using PHP to allow using
Okay, this one is pretty obvious to everyone who use Django and frequently asked
Okay, here's the rundown. I'm developing a video hosting site with PHP and jQuery
Okay I am having some problems with being able to change bitmaps when a
Okay, I've been messing around with the excellent JodaTime library, attempting to get a
Okay i know i have to use the JDBC etc, but im not sure
Okay, I'm reading about Linux kernel development and there are some code snippets using
Okay I got some good advice for Mobile Detection but still having an issue
Okay, so I've tried to use sort to vector of items so the size
Okay, first some background, I can't use any javascript library except YUI for this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.