json_encode is a PHP function that converts a PHP value into a UTF-8 JSON encoded string.

learn more… | top users | synonyms

0
votes
0answers
8 views

Json response for Pivot vlaues

I have this model public class DTO { public int Id {get;set;} public string Name { get; set; } public string LastName { get; set; } //[JsonConverter(typeof(KeyValuePairSerializer))] ...
0
votes
1answer
12 views

How to encode an ArrayList<Complex Object> to json in an Android application and post it to a Java REST web sevice?

I need to know how to encode an object of type ArrayList to json format in an Adroid application and how to post the encoded json string to a REST web service that consumes json? Thanks in advance.
-1
votes
1answer
19 views

encoding php postgres json_encode

I have a problem with my encoding... Everything is UTF-8 configured, namely my database (postgres) and my php files. when I execute this script: $eleves = $serviceManager->getAll('Eleve'); echo ...
0
votes
3answers
34 views

How to fix this character in a string “’”. Not working with json_encode

In mysql table, i have data having this character ’. Like: Francesca’s Baker But when i use json_encode it gives null instead of the string. The problem i have found is with this character ’ or ...
0
votes
1answer
36 views

How to get Json array name json_encode from php array? Android

I'm kinda stuck with this problem, I'm about to parse JSON to my android app. I created my own model in php using this: class Users extends CI_Model { function get_all() { $query = ...
1
vote
1answer
19 views

Turning an indexed array to json object in PHP

When I use json_encode I get one large array filled with objects. How do I get the result to return many json objects. e.g current result [{data1}, {data2}, {data3}] the result i want ...
0
votes
1answer
22 views

Trying to grab a json file to cache it locally

<?php $json_url = 'https://api.feedbin.me/v2/entries.json'; $username = 'username'; // authentication $password = 'password'; // authentication $ch = curl_init( $json_url ); $options = array( ...
0
votes
0answers
22 views

Google Chrome character encoding while sending PUT requests to the server

I am trying to send a chunk of data from a text field which looks like this Auth vers : 5b # #       Product License File #       DO NOT EDIT THIS FILE!! # #       Technical Support: ...
0
votes
0answers
68 views

json or jquerry works on localhost but not on live server

This code to login user works on localhost but not on live server. index.html will post variable to checklogin.php via ajax and the response is either 0 or 1. Right now I don't get either. Wrong ...
0
votes
3answers
46 views

Using json_decode to retrieve ajax-sent javascript array for email

I'm trying to email the contents of a JS array by encoding using JSON.stringify and then decoding in the PHP which should then be sent via email. I get a success alert that the data is sent to the PHP ...
0
votes
2answers
29 views

Unable to print JSON response in HTML page AJAX

I have a AJAX function as below: function ajx(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch ...
0
votes
0answers
16 views

How to encode form input to UTF-8 for use in PHP's json_encode

I have a form that accepts a small string of text. After the form is submitted, the string is packed with some other data using json_encode and sent to another web service. I have noticed that when ...
0
votes
2answers
39 views

Failed to assign variable taken from database to json array

I try to get the data from database to display data via ajax but failed to worked. It's partially working because data from mysql make this thing failed to function. Here is my ...
1
vote
2answers
56 views

Getting a PHP variable inside an Ajax return?

I'm getting a variable inside my catch (for when a web service call fails) statement and attempting to use json_encode on it: try { WebServices::create($this->nameWS); } catch (Exception $e) { ...
0
votes
1answer
72 views

Escape backslash in JSON encoding python

I m trying to JSON encode the following dict. But in this case, the message which is actually a unicode character DEVANAGARI LETTER. So, while encoding this dict into a json object, it seems to ...
-2
votes
0answers
22 views

small Json code add my json page [closed]

i install wordpress plugin she get Json recent posts if you see her in this site it's add code in the begging 15a0d http://sweets.3bnat.com/?json=get_recent_posts in another site in the server ...
0
votes
2answers
27 views

Is JSON.parse() necessary?

I'm retrieving some data from my server using PHP. I want to use this data in a javascript application so I'm doing something like this: var polylines = <?php echo json_encode($polylines); ?>; ...
2
votes
2answers
61 views

json_encode returns undefined with array of non-associative arrays

I try to encode data to JSON in PHP (Version 5.3.13) and send it to JavaScript. My problem is: When I encode an array of non-associative arrays, it returns undefined: $arr = array(array(1, 2, 3)); ...
0
votes
0answers
44 views

Prestashop Web service to return JSON

After extensive search over internet i am sure that Prestashop does not return data in JSON format, it only returns in XML format (which leads to cross domain accessing issue unfortunately). Now, I ...
0
votes
4answers
41 views

How to save json_decoded values (only) as one string into a $var

Im receiving the following variable sent as a json array from javascript: $_REQUEST['fb_friend_uid'] I then decode the array and then do a var_dump $string = json_encode($_REQUEST['fb_friend_uid']); ...
1
vote
5answers
29 views

If array is empty how do I exclude it from json_encode? (PHP)

I'm building json sub-array structure (from CSV) using the following PHP: $tracks = array(); foreach ($result['tracks'] as $trackdata) { $songId = $trackdata['songId']; $title = ...
-3
votes
1answer
29 views

Use json_decode on a multidimensional array [closed]

im trying to decode a 2-dimensional array in php with json_decode. I create my array like this: $query3 = 'SELECT * FROM `files` WHERE `company`="'.$_POST['company'].'"'; $result3 = ...
0
votes
1answer
36 views

PHP make multidimensional JSON array

I'm trying to make a JSON array from the jquery ui map that has this structure {"markers":[{"latitude":57.7973333, "longitude":12.0502107}, {"latitude":57.6969943, "longitude":11.9865}]} Right now, ...
0
votes
2answers
31 views

Ajax Form does not returns in html

my ajax codes are: $.ajax({ type: "post", dataType: "json", url: "contact.php", data: $("form").serialize(), success: function(data) { ...
1
vote
1answer
48 views

How can I create js array from json object returned from php?

Javascript has this fin line of code that alerts you what type of object you are working with. It is the following: alert(Object.prototype.toString.apply(obj)) So, I am working with php and js - ...
0
votes
2answers
76 views

JMS Serializer doen't expose one property

I making a RESTful app with Symfony and FOSRestBundle. FOSRestBundle uses JMS Seriazlizer to serialize data to json format. I have everything working with one little issue. This is my Entity class ...
0
votes
0answers
31 views

How can I use JSON mobile application in flash builder 4.6

mi código es el siguiente : "my code is the following:" <fx:Script> protected function view1_creationCompleteHandler(event:FlexEvent):void { refreshBO = new RefreshBO(); ...
-1
votes
2answers
50 views

Using php variables inside JSON [closed]

I have a query to look up the user's info in a php file. I am using json_encode in the same file to send the data to Ajax so that it can be displayed using .html() function. The problem is, the php ...
0
votes
2answers
23 views

Setting Danish Character Text

I am getting some strings from json. My string contains special characters like "æ" from Næstved an many more like "ø" from køkken. But When I set Text these strings to ant textview, I get my strings ...
-2
votes
3answers
50 views

Take off '[' from Json string?

I have a JSON return string from MongoDB [{'api_calls_per_day': 0.29411764705882354, '_id': ObjectId('51948e5bc25f4b1d1c0d303a'), 'api_calls_total': 5, 'api_calls_with_key': 3, ...
0
votes
1answer
43 views

PHP json_encode and XSS

This question has been asked many times. See here, here and here Based on the answers in those questions I did some tests and I'm forced to ask the same question again as none of the answers appear ...
1
vote
2answers
136 views

TypeError: ObjectId('') is not JSON serializable

My response back from MongoDB after querying an aggregated function on document using Python, It returns valid response and i can print it but can not return it. Error: TypeError: ...
1
vote
1answer
49 views

Fetching data from the server to Backbone giving me a weird json

I'm trying to fetching data from the server with backbone, this is my request: I initialize the view with this: // Backbone view initialize this.collection = new Dropdown.Collections.Brands(); ...
0
votes
1answer
174 views

XCode -> ASIHTTPRequest-> php -> mysql -> json_encode ->xcode response -> table view

I want to do this.Get data from table view controller send request through ASIHTTPRequest: -(void)getData { NSURL *url = [NSURL URLWithString:@"http://10.10.10.10/application.php"]; //some ...
0
votes
0answers
57 views

Jqgrid wont load Json Data

I have been looking for a grid program for awhile and after looking through these pages came up with Jqgrid as the one to go for. So I am new to this. Issue I am having is loading my grid with the ...
0
votes
1answer
74 views

HTTP Error 500 (Internal Server Error) in Drupal

Iam providing datas using json to an ios app using php. But while running the code in browser, it is showing Server error. If there is no values in the database, it shows {"posts":null} as provided ...
-1
votes
2answers
48 views

How NOT to double encode a JSON in PHP [closed]

I have an array as such- $blah = array( 'a' => <huge_json_encoded_string>, 'b' => <another_json_encoded_string> ); Now, I want: {'a': ...
0
votes
1answer
28 views

get object variables in abstract class

I have a abstract class which implements the JsonSerializable Interface. version 1: abstract class MyBase implements JsonSerializable { public function jsonSerialize() { ...
0
votes
3answers
60 views

JSON output from PHP

I have data in my database as COl1 | COL2 fruit | apple, grape, berry vegetable | tom, pot, leaf If I query for fruit, I want COL2 to read for the query and data is split and output echo ...
1
vote
3answers
44 views

Why does the PHP json_encode function convert UTF-8 strings to hexadecimal entities?

I have a PHP script that deals with a wide variety of languages. Unfortunately, whenever I try to use json_encode, any Unicode output is converted to hexadecimal entities. Is this the expected ...
0
votes
2answers
36 views

Get an array element by key php

I have an array of (many) arrays, encoded at different depths. The problem is that I know the key of the element I am searching for, but not the depth of the encoding. So for example it might be ...
0
votes
1answer
46 views

How to generate a pass from 2 different json_encodes

I use this method to generate a pass: public function setJSON($JSON) { if(json_decode($JSON) !== false) { $this->JSON = $JSON; return true; } $this->sError = 'This is not ...
0
votes
1answer
27 views

Unable to parse 2 dimensional json data using jqery sent from server using php

$.post('ol_st_checker.php',function(d){ //this method is going to check who ever is online $.each(d.uinfo,function(index,value) { alert(index+'='+value); ...
2
votes
1answer
148 views

JSONArray cannot be converted to JSONObject Android

I am trying to consume json data from a server in android app. the format of data which is from a cakePHP web app looks like this; [{"Chapter":{"id":"1","chapter":"4","chaptertitle":"The Bill of ...
0
votes
0answers
28 views

php file fail to be executed with file_get_contents() in json array

I return these data (second_img_url,third_img_url and file) in html file by jquery(ajax) but when this file finish_create.php comes, I found PHP script in it not executed at all. $data=array( ...
1
vote
2answers
88 views

php json encode - array keys not output as strings

So I have a php array like this: $myArray = array( 'name' => 'Series Name', 'data' => array( array("2012-11-13",0.71), array("2012-11-14",0.45), array("2012-11-15",0.65), ...
0
votes
1answer
70 views

How to print json array using jquery ajax?

i am stuck at some json parsing, i am populating some fields using jquery's ajax function, i found the desired result, but dont know how to print it, here is my code function logged_in_users() { ...
0
votes
3answers
102 views

json_encode() on a multidimensional array - with string keys

I am creating an very large multidimensional array using PHP. Each object contains Name, ID, ParentID and Children. Children is an array of more objects in the same format. It is critical I name the ...
0
votes
2answers
42 views

json formatting_adding a tag to it

here is the PHP file that im using to generate the JSON with: <? $databasehost = "wbw.com"; $databasename = "wtest"; $databaseusername ="w"; $databasepassword = "123"; $query = "SELECT * FROM ...
-1
votes
1answer
77 views

PHP json_encode not working with chinese character set [closed]

<?php header("Content-type: text/csv; charset=GB2312"); $arr = array('丂','亐'); echo json_encode($arr); ?> Instead providing chinese character array, json_encode return null values.

1 2 3 4 5 15
15 30 50 per page