Jump to content

Is This The Corect Json Format?


colap

Recommended Posts

array(3) {
[0]=>
string(18) "23.80484,090.40694"
[1]=>
string(18) "23.79942,090.41605"
[2]=>
string(18) "23.79118,090.41692"
}

 


string(64) "["23.80484,090.40694","23.79942,090.41605","23.79118,090.41692"]"

 

Is it the correct json format after json_encode ?

 

Isn't the json format contains { .. } ?

 

<?php
$arr = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5);

echo json_encode($arr);
?>

 

The above example will output:

 

 

{"a":1,"b":2,"c":3,"d":4,"e":5}

 

 

http://php.net/manua...json-encode.php

Edited by php-coder
Link to comment
Share on other sites

Have a look at http://json.org which shows how JSON should be structured in easy to follow graphical form.

 

JSON is built on two structures:

- A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.

- An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.

 

It is the array structure that you have.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.