json « object « Javascript Data Type Q&A

Home
Javascript Data Type Q&A
1.Array
2.Clojure
3.date
4.decimal
5.function
6.global
7.loop
8.math
9.number
10.object
11.Regular Expression
12.scope
13.String
14.Var
15.variable
Javascript Data Type Q&A » object » json 

1. What's the best way of passing a .NET System.DateTime using JSON so that cient-side javascript can construct a javascript Date object?    stackoverflow.com

I'm building the JSON string "by hand" server-side. Should I Convert.ToString(System.DateTime.Milliseconds) on the server-side and use javascript Date.setTime(milliseconds) on the client side?

2. How can I get a JSON object from a SQL Server table?    stackoverflow.com

I have a view that I want to be converted into JSON. What is the SQL that I can use to produce on the server the JSON string needed to be ...

3. Assigning variables to objects in JavaScript    stackoverflow.com

I am using the following method to basically create a JSON string.

var saveData = {};
saveData.a = 2;
saveData.c = 1;
However the .a and .c don't cut it for what I need to ...

4. Javascript Objects: Dynamic variable names?    stackoverflow.com

This is probably a no-brainer, but how can I make this happen:

var name = otherObject.name; //"string"
var o = { 
            ...

5. how to construct a json object using info from several javascript arrays    stackoverflow.com

I have two js arrays already, say: names and values (with the same length), now I would like to construct a json object in certain format? For example:

 names = ["label1","label2","label3"];
 ...

6. refer to an element of JSON (Javascript) object    stackoverflow.com

How do I refer to an element of JSON (Javascript) object. exampe: alert(homes.Agents[1].name);

<script>
    var homes = [
 {
    "Agents" : {
     ...

7. Retrieving data from a JSON sub array in javascript, where identifier starts with an integer    stackoverflow.com

I must be missing something simple here, but I'm having trouble retrieving data from a JSON array response. I can access objects with identifiers that start with letters, but not ones ...

8. Use a JSON array with objects with javascript    stackoverflow.com

I have a function that will get a JSON array with objects. In the function I will be able to loop through the array, access a property and use that property. ...

9. how to build a string of id's from a json object    stackoverflow.com

My json object looks like:

User { ID: 234, name: 'john', ..);
I want to build a string of all the ID's. How can I do this? is there a more elegant way than ...

10. How can I access this nested array within my JSON object?    stackoverflow.com

I'm using PHP to return a json_encode()'d array for use in my Javascript code. It's being returned as:

{"parent1[]":["child1","child2","child2"],"parent2[]":["child1"]}
By using the following code, I am able to access parent2 > child1
$.getJSON('myfile.php', function(data)
{
 ...

11. How to iterate over an array of objects in JavaScript?    stackoverflow.com

I'm using PHP to fetch "tasks" from my database and encoding it as JSON. When I transfer the data over to javascript, I end up with something like this:

Array {
  ...

12. CouchDB view composing JSON objects with embedded arrays from two separated documents    stackoverflow.com

Lets say I have two types of documents stored in my CouchDB database. First is with property type set to contact and second to phone. Contact type document have another property ...

13. Getting Date and/or checking for it in JSON Object?    stackoverflow.com

I have a JSON object that can (is) storing a Date (and/or any other JS object) but I'm not sure how to get it out once it's in it. For example ...

14. JSON Object containing Array    stackoverflow.com

I have JSON,like,

var jsondata = {
  "an_array" : [[2,4],[1,2]]
} 
With JavaScript, I want to use a for loop to go through each element of the array in the array, like,
var ...

15. How do I add JSON object as new level to another JSON object?    stackoverflow.com

I have a code that gets in the end collection of two JSON objects, something like this.

var jsonL1 = {"holder1": {}}
var jsonL2 = {"section":"0 6","date":"11/12/13"}
I would like to insert jsonL2 ...

16. Are Javascript arrays primitives? Strings? Objects?    stackoverflow.com

I've been monkeying with Javascript for several years now (since back in the day before Gmail, Facebook, and YouTube, if you believe such a day existed). Big high-five to Thau. My Question, ...

17. How to put an Array object into JSON?    stackoverflow.com

I have written the following Javascript code. It's the best I could do to get my data formatted as valid JSON:

var roles = getSelectedRoles(); // returns an Array object

/* TODO: ...

18. Handling JSON Object Array    stackoverflow.com

I got a realy simple question: Take a look at this JSON String:

this.objects = [{"pid":"2","x":"10","y":"10"}]; // only one i know
Now i would like to adress an object out of it like ...

19. How to check if the JSON data is one object or an array of objects?    stackoverflow.com

I got server responsed JSON data:

var data = SERVER_RESPONSE;
this data could be an object {id: 12, name: John}, it could also be an array of objects [{id: 12, name: John}, {id: ...

20. How do I access a JSON object using a javascript variable    stackoverflow.com

What I mean by that is say I have JSON data as such:

[{"ADAM":{"TEST":1}, "BOBBY":{"TEST":2}}]
and I want to do something like this:
var x = "ADAM";
alert(data.x.TEST);

21. 2D JSON String Array Deserialized into JavaScript objects    stackoverflow.com

Hi I have a JSON string that looks like this:

{"2000":["1", "2", "3"],"2001":["1", "2", "3"],"2002":["1", "2", "3"]}
The string above comes from the "backend" and my JavaScript function receives the JSON string as ...

22. Javascript Object to Array    stackoverflow.com

I'm having some problems with converting some JSON and I'm after some help. This is my problem, I have JSON returned the following: Example of the JSON recieved (from a CSV ...

23. How i can send array of objects from js to server?    stackoverflow.com

My class

[Serializable]
    public class VSpecialQualifiers
    {
        public VCD LivingStatus { get; set; }
      ...

24. Should I be using strings to delimit the object names in JSON?    stackoverflow.com

I have seen a tutorial that has the following JSON:

{

   books:[{title:"frankenstein"},{title:"Moby Dick"}]

}
When I put the above into js.bin I get an error saying that it expect a string and ...

25. Array of JSON Objects    stackoverflow.com

Good morning, I am new to JSON and am trying to re-implement a page using JSON instead of some 2-dimensional arrays. What I am hoping to accomplish is get an array of objects. ...

26. Encoding Javascript Object to Json string    stackoverflow.com

I want to encode a javascript object into a json string and I am having considerable difficulties. The Object looks something like this

new_tweets[k]['tweet_id'] = 98745521;
new_tweets[k]['user_id'] = 54875;      ...

27. Using Variables as Object Member Names in Javascript    stackoverflow.com

I'm writing code to set up a lookup structure in Javascript

var g_Codes = {
    "Type1": {
        "U.S.": "US1",
    ...

28. JavaScript push to array object is not working    stackoverflow.com

I have an html like below HTML:

 <INPUT TYPE=CHECKBOX NAME="clcik" onClick="add('1234','blah')" />
 <input type="hidden" id="project" value="" />
JS:
    function add(obj1 , obj2){
    var jsonArray = [];
  ...

29. Accessing an array in JSON object in javascript    stackoverflow.com

I have the following JSON object in javascript returned by a PHP web service :

data={
"result": "pass",
"error_type": "",
"feedback_ids": {
    "feedback0": "1",
    "feedback1": "8"
},
"redirect_uri": ""
}
alert(data.result) works ...

30. How to save an object to a database as json string and reload later?    stackoverflow.com

So I have a Module object, and I have a AdvModule object which inherits from Module using the following:

function object(o) {
    function F() { }
    ...

31. JavaScript -- split off one branch of a hierarchical array or JSON object    stackoverflow.com

I have a JSON object that is a nested array that is of the following form:

{
    "name": "Math",
    "children": [
    ...

32. Code not adding object to an array    stackoverflow.com

I'm trying to add a set of objects that have been retrieved from a JSON file into an array. I've tried using push but the result is the same. The length ...

33. Constructing array of objects programmatically    stackoverflow.com

Say I want the object to be something like this:

var Book = {
        title: "the catcher in the rye",
      ...

34. How to get child of child of object in javascript. (If exists)    stackoverflow.com

I get some json data, and there I have such a structure:

'modules' : {
    'category1' : {
        'section1' : {
  ...

35. Delete single element from array/json object?    forums.devshed.com

36. JSON arrays/objects    forums.devshed.com

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.