JavaScript JSON Selector Engine

Daten im JSON-Format können ziemlich komplex sein und die Analyse (Parsing) aufwendig machen. Nicht selten kommt dann der Wunsch nach einer Möglichkeit auf, die gewünschten Daten einfacher zu selektieren. Die erfreuliche Nachricht ist, dass es eine solche Möglichkeit in Form einer „selector engine“ gibt. Mit JSON Select können komplexe JavaScript-Objekte mit CSS-ähnlichen Selektoren durchforstet werden. Ich habe dazu ein kleines Beispiel vorbereitet.
JavaScript JSON Selector Engine weiterlesen

How to parse JSON with jQuery

With jQuery you could easily parse a JSON (which is an object in JavaScript Object Notation). The method parseJSON of jQuery translates the JSON even into the corresponding JavaScript data types. As an example I have chosen the following JSON:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
        "firstName": "Joe",
        "lastName" : "Black",
        "age"      : 28,
        "address"  :
        {
          "streetAddress": "1st Street",
          "city"         : "New York",
          "state"        : "NY",
          "postalCode"   : "10021"
        },
        "phoneNumber":
        [
          {
            "type"  : "home",
            "number": "212555-1234"
          },
          {
            "type"  : "fax",
            "number": "646555-4567"
          }
        ],
        "married" : true,
        "developer" : true	
}

This JSON contains nested objects like address, an array like phoneNumber and key-value pairs of different types like firstName (string), age (number) and married (boolean).

Here it is shown how it is parsed:
How to parse JSON with jQuery weiterlesen