JSON

860

Solutions

843

Contributors

JavaScript Object Notation, or JSON, is human-readable text used when transmitting data objects consisting of attribute:value pairs between a server and a web application as an alternative to XML. JSON, while it is originally derived from JavaScript, is a language-independent data format. Code for parsing and generating JSON data is available in many programming languages.

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi,

I have these classes:

Public Class Party
    Public Property partyIdentifier As String
    Public Property email As String
    Public Property telephone As String
    Public Property role As String
End Class

Public Class Car
    Public Property registrationNumber As String
    Public Property registrationNumberMissing As Boolean
    Public Property model As String
    Public Property used As Boolean
    Public Property year As Integer
    Public Property mileage As Integer
    Public Property objectGroupType As String
End Class

Public Class Calculation
    Public Property cashPrice As Integer
    Public Property downPayment As Integer
    Public Property residualDebt As Integer
    Public Property creditTime As Integer
    Public Property interest As Double
End Class

Public Class Insurance
    Public Property monthlyCost As Integer
End Class

Public Class Finance
    Public Property contractType As String
    Public Property customerType As String
    Public Property customerLicenceType As String
    Public Property Parties As List(Of Party)
    Public Property car As Car
    Public Property calculation As Calculation
    Public Property profileId As Integer
    Public Property campaignId As Integer
    Public Property plannedDeliveryDate As DateTime
    Public Property insurance As Insurance
End Class

Open in new window


I'm now trying to build this as an object that I can serialize into json like this:
 If Not Page.IsPostBack Then
            Dim f As New Finance

            ' Basic
            f.contractType = "Installment"
            f.customerType = "Private"
            f.customerLicenceType = "SwedishDriversLicense"

            ' Parties
            Dim p As New Party With {
                .partyIdentifier = "8811119307",
                .email = "nordberg.peter@gmail.com",
                .telephone = "0854545656",
                .role = "Buyer"
            }
            f.Parties.Add(p)

            Dim json As String = JsonConvert.SerializeObject(f)
            Label1.Text = json
        End If

Open in new window


The problem is that I get an error that an object doesn't exist when adding an party item to the lost of parties as can be seen in below image.
 Objkect error
What am I doing wrong and how can I fix it?

Peter
0
Rowby Goren Makes an Impact on Screen and Online
LVL 13
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

Our application built with C# and SOLR search.

One of my requirement to implement partial updates with SOLR.I am getting an error while posting JSON data into SOLR server.

Error Response from SOLR API:

{
    "responseHeader": {
        "status": 400,
        "QTime": 30
    },
    "error": {
        "metadata": [
            "error-class",
            "org.apache.solr.common.SolrException",
            "root-error-class",
            "org.apache.solr.common.SolrException"
        ],
        "msg": "Atomic document updates are not supported unless <updateLog/> is configured",
        "code": 400
    }
}

Open in new window

0
I am pulling data from an API and I believe it is returned as a JSON string, how can I read certain data from the string ?  There are rows of data I want to loop through and put in a datatable, but can not figure out how to extract the data.

I have attached 3 files - the first 2 is the data I want to access, the third is the name of the columns.

Path to Column NamesWhere the data is - Label and Value are two fields inside I want to access.Path To Data
0
For sending requests to a webservice that deserializes Json, what items in this list are 'required' by the webservice?

HTTPMethod:  
SSLTimeout:  
SSLApplicationID:
SSLCertStore:
SSLCertStorePassword:
SSLVerifyPeer:  
SSLVerifyHost:  
HTTPVersion:
# BasicAuthUser:
# BasicAuthPassword:
# ProxyURI:
# ProxyUser:
# ProxyPassword:
# SendHTTPHeaders:
# HeaderCookieData:
# ResponseCookieFile:
# HeaderSOAPAction:
# HeaderUserAgent:
# HeaderAccept:
# HeaderHost:
# HeaderReferer:
# HeaderConnection:
# HeaderContentType:
# CustomHeaderName(1): Authorization
# CustomHeaderValue(1):
# InputCcsid: 0
# OutputCcsid: 0
# EnableExpectHeader:  
# LocalInterface:
# Enable IPv6:
0
Dear Experts, I use PHP 7.2

I get json file from an API, and I get the data like below.

 "{"ReturnData":"k01 : ","ReturnCode":1,"page":null,"products":[{"ProductId":1,"ProductName":"someting"},{"ProductId":4,"ProductName":"something else"}],"transactions":null}"
 
 
I get the variables like this :

echo "<br>" . "ReturnCode: " . $book->ReturnCode;

However I can not get the data of with the products which is an array I suppose.


My code works like this:
 $book = json_decode($result);
// access title of $book object
echo "ReturnData :" . $book->ReturnData; 
echo "<br>" . "ReturnCode: " . $book->ReturnCode;
echo "<br>" . "page: " . $book->page;
echo "<br>" . "transactions: " . $book->transactions;

Open in new window



I don't know how to get products?
How can I get the products and the variables inside of the products?

thank you
0
Have a vendor product CT FreightRater, an automated rating database used to calculate rates for loads we haul. We can enter hundreds of scenarios for rates like mileage, flat rate from point to point.
FreitRater recently did a changeover from running their WebService using XML, to using JSON. I have my JSON data conversion code ready, but need assistance setting up the front parameters that allow the HTTP URL, validation, etc.
In my RPGLE program, I use a product called RPG-XML Suite from Krengeltech. It supplies API's I can use to formulate my data into the JSON format, and that's working fine.
I can test through a program on the FreitRater Server called 'MultiRater'. This allows me to 'drop' in formed JSON statements to test against the rating database, and receive a response.
Unfortunately, FreitRater is unable to provide the specs for what these parameters are.
The only example I received from them to allow testing sending a RatingRequest example (C# .NET), is attached.

I'm also including the RXS_TransmitDS_t data structure used to 'send' to the FreitRater WebService in an attachment.

I need a 'translation' of sorts between the C# .NET example, to be able to  plug in those parameters to the RXS_TransmitDS_t data structure.

How-to-send-a-RatingRequest-Example-.txt

RXS_TransmitDS_t.txt
0
Hi Experts,

could you suggest the best way to convert custom application text log file to json format please

Read the whole file and convert line by line to json on a windows server.

Since application generate log in its custom location, may be I should read this directory for each file > convert each line to json object, place it in a different location. Also we should not duplicate or read the same line again :)

Also is it possible to apply similiar logic to windows events log.

please advice
0
Hi

I have a familiarity with Microsoft Access (with VBA),  and some VB.NET (via Visual Studio)

I now need to learn JSON. I will be using JSON to interact with a cloud based Point of Sale system (Lightspeed). At least this is my long term objective.

I want to start on the right path.  I know that this can be done with Notepad, but I am thinking that I should develop a familiarity with some solid editor for this purpose.

My question....  What free (or almost free) good software would I use to write code in JSON.
It's easy to find "the best" editor by doing a websearch, but I would value the opinions of the experts here.
Thank you.
0
Hi,

I have JSON string looking like this:
{  
   "status":"success",
   "result":{  
      "0":{  
         "id":115718,
         "sender_id":12464,
         "due_date":"0000-00-00 00:00:00",
         "language_id":"sv",
         "last_event":"2019-03-07 14:42:59",
         "visible_name":"PurchaseContract_100",
         "name":"PurchaseContract_100",
         "reminder_dates":"0000-00-00 00:00:00",
         "offer_status":4,
         "offer_type":1,
         "user_details":"{\"first_name\":\"Webcars Logistik\",\"last_name\":\"\",\"company\":\"Webcars\",\"email\":\"logistik@webcars.se\\r\\r\\r\\r\\r\\r\\r\\r\\r\\r\\r\\r\\r\",\"reg_no\":\"\",\"address\":\"\",\"telephone\":\"\",\"post_code\":\"\",\"city\":\"\"}",
         "unique_id":"5c811fad442af",
         "created_date":"2019-03-07 14:42:05",
         "signed_date":"2019-03-07 14:42:59",
         "last_sent_emailreminder":"0000-00-00 00:00:00",
         "last_sent_smsreminder":"0000-00-00 00:00:00",
         "unread_notification":1,
         "offer_rejected":0,
         "recieved_by":0,
         "overview_deleted":0,
         "bcc":"",
         "recipients":"[{\"email\":\"nordberg.peter@gmail.com\",\"full_name\":\"MUSICCENTER SKARA AB\"}]",
         "link_template":"",
         "is_shared_doc":0,
         "verification_sent":1,
         "expire_notification_sent":0,
         "due_notification_sent":0,
         "contract_chat":0,
         "thumbname":"",
         "thumb":1,
         "video_link":"",
         

Open in new window

0
I'm attempting to display part of an array from JSON when the user clicks on an ID in the dropdown. The data is loading data twice and then subsequent clicks just layer array upon array even though I have set my array to clear when update() is fired. I'm also getting a "update is not defined at HTMLAnchorElement.onclick" although that function itself is firing when the page loads.

How can I resolve the error and only display the one set of matching data? Here is a fiddle: https://jsfiddle.net/dtepdc/4e6mfoct/

Here is the code:

let dataset = [
    {
        "scene": "IR0006426320",
        "scene_start_time": "2018-02-05T15:03:30",
        "chips": [
        {
            "chip": "2018.02.05.150",
            "start_date": "2018-02-05T00:05:07",
            "end_date": "2018-02-05T01:26:23",
            "co_num":["None"],
            "cause": false
        },
        {
            "chip": "2018.02.05.192",
            "start_date": "2018-02-05T15:48:08",
            "end_date": "2018-02-05T17:22:34",
            "co_num": [
                "C03619354",
                "C03618763",
                "C03619064",
                "C03619325"
            ],
            "cause": false
        },
        {
            "chip": "2018.02.05.26",
            "start_date": "2018-02-05T16:38:56",
            "end_date": "2018-02-05T21:08:00",
            "co_num": [
                "C03610724"
            ],
            "cause": false
        },
        {
            "chip": 

Open in new window

0
Become a CompTIA Certified Healthcare IT Tech
LVL 13
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

To be clear upfront, I'm not a professional - just trying to get a task done and I have minimal expertise. What I thought would be easy is apparently not so. I've dealt with APIs and XML but it's always been me initiating. This is apparently different.

Goal:

Receive HTTP POST Webhook data from my Wordpress/Woocommerce website.

==============================================

If you're receiving an http post and it contains the variable/value status:completed

CFIF CODE HERE

Loop through line_items in this transaction

CFIF CODE HERE

Do this if the item is a download

CFIF CODE HERE

Do some database inserts. I've got all this code written and ready to go.

==============================================

1.  The webhook is working and being received perfectly by RequestBin.
2.  HTTP in JSon is being sent.
3.  I'm not even sure the request is being heard by my CF Template.
4.  When I try to write the received data into a session variable so I can at least see it, nothing is there?!?!
Need to know... Is my code being triggered? If not, how can I make it be so. AND Once I'm able to assess that I'm receiving data, how can I curse down into it and grab the bits of info (is the result an array or structure and what's the syntax to drill down)?? Specifically, I only need...

status

line_items.sku

TIA for HELP.

==============================================

First line of code in my CF template to receive HTTP POST from Webhook

Open in new window

0
I only need to extract certain data from a nested JSON file.

I'm able to do it using VBA and Python but I'm not having much luck using C# with NewtownSoft.JSON.

In the attached file the data I want to extract is  'type' and 'averageSpeedMetersPerSecond' for each node under 'state\tracks\3'.

Hope that makes sense, and apologies if I'm not using the correct terminology.

Oh, by the way here's where I am so far.
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace TestJSON
{

    public class Test
    {
        public Newtonsoft.Json.Linq.JObject State { get; set; }
        public Newtonsoft.Json.Linq.JObject CachedValues { get; set; }
    }

    public class Track
    {
        public List<String> Path { get; set; }
        public string Type { get; set; }
        public double Speed { get; set; }
    }

    class Program
    {
        static void Main(string[] args)
        {
            using (StreamReader file = File.OpenText(@"C:\Test\JSON Test\1550370300.json"))
            {
                JsonSerializer serializer = new JsonSerializer();

                Test test1 = (Test)serializer.Deserialize(file, typeof(Test));

                object tracks = test1.State;

                Console.Write(tracks);

                Console.ReadLine();

            }
        }
    }
}

Open in new window

1550370300.json
0
How to get around the jQuery.ajax CORS and Jsonp callback problem?
I'm writing a solution in a WordPress plugin which requires an api GET call, and will later require POST too, from JavaScript.
My initial attempt resulted in a CORS policy block:
Access to XMLHttpRequest at 'https://app.xxxxx.com/api/pub/v1/contacts/528a34f9-dbc1-4c50-ad6b-a9f300e19ea9' from origin 'https://www.xxxx.co.uk' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Open in new window


This is what the jQuery looked like:

function generateCandidate(cuid){
    console.log('Generating New Candidate');
    var api = my_api()
    var candUrl = "https://app.xxxx.com/api/pub/v1/contacts/" + cuid;
    var da = {
        api_key: api,
    }
    jQuery.ajax({
        url: candUrl,
        data: da,
        type: "application/json",
        method: 'GET',
        success: function(resp){
            console.log(resp);
        },
        error: function(err){
            console.log('Ajax ERROR:');
            console.log(err.toString());
        }
    });
}

Open in new window


So I did some research and discovered plenty of people were getting around the CORS issue by specifying the 'jsonp' type instead of json. So I tried replacing
        type: "application/json",

Open in new window

with
dataType: 'jsonp',

Open in new window


But then I discovered I need to specify a callback somehow, because the error I get is this:

jquery.js?ver=1.12.4:4 GET https://app.xxxx.com/api/pub/v1/contacts/528a34f9-dbc1-4c50-ad6b-a9f300e19ea9?callback=jQuery1124036525732914578746_1550866428904&_=1550866428905 net::ERR_ABORTED 404

Open in new window


I've read about how the callback can be sent to a function, and handled that way to make it work. But I can't find out what the function should do, or how to write it.
And I'm not sure if that's what I should be doing anyway, or if there's any way I can solve the CORS problem in a way it can be used publicly, and not just in my own browser.

Can anyone assist, or point me in the right direction to get this solved.

Many thanks
Tim
0
I have mvc / razor app using ajax to make some transactions. everything is working fine.
But just we will add more parameters in data and It is going to super long list. so I want to find better way to handle this codes below.
I am thinking using json format passing value from front to the back. but do not know how to do it.

my question is:

1. is it best practice to use json format to pass list of value back and forth? If yes, can you show me how to do it with my codes below?
2. If json is not, can you suggest me what to do?
3. On the end - code behind. I do have lead class. and hope the best will be JsonResult CreateLead(Domain.Lead l) so I do not have to worry too much about list too long.


Thanks


$.ajax({
                                url: "/Home/CreateLead",
                                datatype: "text",
                                data:
                                {
                                    'firstname': document.getElementById("first-name").value,
                                    'lastname': document.getElementById("last-name").value,
                                    'phonenumber': document.getElementById("phone-number").value,
                                    'emailaddress': document.getElementById("email-address").value,
                                    'totalcountadult': document.getElementById("total-count-adult").value,
                                    'totalcountkid': 

Open in new window

0
We use https://geo.ipify.org/
and get the string from their Geo API as follow:

{"ip":"16.81.253.114","location":{"country":"US","region":"California","city":"Los Angeles","lat":33.2342,"lng":-117.9063,"postalCode":"90032","timezone":"America\/Los_Angeles"}}

1. Is it a Json format?
2. how to use c# foreach statement to get list of object (country, region, and postcode)?

Thanks
0
I am using HighCharts and when loading the View, the source for Highcharts is loaded after the DOM.  The chart does not display.

My View looks like this:

@{
    ViewBag.Title = "Warranty Expiration Chart";
}

<div class="jumbotron">

    <div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>

</div>

<script type="text/javascript">
    $(document).ready(function () {
        $.getJSON("GetMaintenanceExp", function (data) {

            Highcharts.chart('container', {
                chart: {
                    plotBackgroundColor: null,
                    plotBorderWidth: null,
                    plotShadow: false,
                    type: 'pie'
                },
                title: {
                    text: 'Maintenance Expiration Chart'
                },
                tooltip: {
                    pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
                },
                plotOptions: {
                    pie: {
                        allowPointSelect: true,
                        cursor: 'pointer',
                        dataLabels: {
                            enabled: true,
                            format: '<b>{point.name}</b>: {point.percentage:.1f} %',
                            style: {
                                color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
                            }
                        }
                    }

Open in new window

0
How do I convert the following nested XML creation:
 
Dim xmlKW As String = "  <keywords>" &
            vbCr & vbLf & "    <item>" &
            vbCr & vbLf & "      <name>angels</name>" &
            vbCr & vbLf & "      <enabled>true</enabled>" &
            vbCr & vbLf & "      <threshold>0.5</threshold>" &
            vbCr & vbLf & "    </item>" &
            vbCr & vbLf & "    <item>" &
            vbCr & vbLf & "      <name>there</name>" &
            vbCr & vbLf & "      <enabled>true</enabled>" &
            vbCr & vbLf & "      <threshold>0</threshold>" &
            vbCr & vbLf & "    </item>" &
            vbCr & vbLf & "    <item>" &
            vbCr & vbLf & "      <name>test</name>" &
            vbCr & vbLf & "      <enabled>true</enabled>" &
            vbCr & vbLf & "      <threshold>0.4</threshold>" &
            vbCr & vbLf & "      <pronunciations>" &
            vbCr & vbLf & "        <item>" &
            vbCr & vbLf & "          <phonemes>t eh s t</phonemes>" &
            vbCr & vbLf & "          <enabled>true</enabled>" &
            vbCr & vbLf & "        </item>" &
            vbCr & vbLf & "      </pronunciations>" &
            vbCr & vbLf & "    </item>" &
            vbCr & vbLf & "</keywords>"

to a serialised string using something similar to:

        public static string SetTime()
        {
            var dateTimeOffset = new DateTimeOffset(DateTime.Now);

            return JsonConvert.SerializeObject(new
0
I want to set up a local JSON file that I can read for testing api access.

I have a file that is quite simple and returns a single user. It is called user.json and has this contents:

{
    "id": 1,
    "email": "first@testurl.org",
    "nameline": "Name Line"
  }

Open in new window


This produces a single array that looks like this: Array ( [id] => 1, [email] =>first@testurl.org, [nameline] => Name Line )

This works great to get back the values for a single user. But what I would like is a JSON data that would return an array multiple users, in this case 3:  I would like the final array to look like this.

Array ( [1] => Array ( [id] => 1, [email] =>first@testurl.org, [nameline] => First Row ), [2] => Array ( [id] => 2, [email] =>second@testurl.org, [nameline] => Second Row ), [3] => Array ( [id] => 3, [email] =>third@testurl.org, [nameline] => Third Row ) )

I will create a separate JSON file called: users.json and it will contain these three records. What should the JSON look like.

My question is what does this file look like? Is this anywhere close?

[code]
{
  [1] {
    "id": 1,
    "email": "first@testurl.org",
    "nameline": "First Row"
  },
 [2] {
    "id": 2,
    "email": "second@testurl.org",
    "nameline": "Second Row"
  },
 [3] {
    "id": 3,
    "email": "third@testurl.org",
    "nameline": "Third Row"
  }
}
[/code
0
Does anyone here know how I might obtain the direct URL to the embedded video that's in this Twitter post ?  

https://twitter.com/thedailyshow/status/1057723072004816896?lang=en

Note that I am NOT looking to download the video .. I only want to obtain the direct video URL.  Please advise.

- Yvan
0
C++ 11 Fundamentals
LVL 13
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

How do I create a JSON array in vb.net using Newtonsoft.JSON (json.net) from this xml string;

<?xml version="1.0" encoding="UTF-8"?>
<result>
  <version>2</version>
  <name>ListResult1</name>
  <model_name>ENGLISH</model_name>
  <my_list>test</my_list>
  <myitems>
    <item>
      <name>thing1</name>
      <enabled>true</enabled>
      <threshold>0.5</threshold>
      <types1/>
    </item>
    <item>
      <name>thing2</name>
      <enabled>true</enabled>
      <threshold>0</threshold>
      <types1s/>
    </item>
    <item>
      <name>thing3</name>
      <enabled>true</enabled>
      <threshold>0.4</threshold>
      <types1>
        <item>
          <otherthing1>text2</otherthing1>
          <enabled>true</enabled>
          <otherthing2>0</otherthing2>
          <otherthing3>true</otherthing3>
        </item>
      </types1>
    </item>
  </myitems>
</result>
0
I am new to SSIS
I am using a Script component in SSIS for parsing a JSON file.
I am getting errors after I add the C# code in the Script component for parsing of the JSON file.

I am attaching a file which describes the issue that I am facing.
Is this a bug in the Software of Visual Studio 2015 professional? Do I need to re-install Visual Studio 2015 professional?
issues-with-json-scripting.docx
0
I am building a Web API in Asp.net core.
This service will be json service and I was given a fixed structure in which all the web API method should return their response results show as below.

I need to know is what be the best way of implementing this.
One option is I create with properties ( same needed for response) and return that as response and set values in its properties.

Or is there any other way as well. Please let me know
 
{
	Data: {Result object },
	Status: true | false
	code: 1 | 2 | 3
	Message: “Any error Message”
}

Open in new window

0
Please read the codes, and the question is below. Thanks
page1.htm 
<script>
var myObj, myJSON, text, obj;

// Storing data:
myObj = { name:"John Smith", age: 31, city: "New York" };
myJSON = JSON.stringify(myObj);
localStorage.setItem("testJSON", myJSON);

// Retrieving data:
text = localStorage.getItem("testJSON");
obj = JSON.parse(text);
document.getElementById("demo").innerHTML = obj.name;
</script>

page 2.html
<script>
var myObj, myJSON, text, obj;

// Storing data:
myObj = { zip:"90032"};
myJSON = JSON.stringify(myObj);
localStorage.setItem("testJSON", myJSON);

// Retrieving data:
text = localStorage.getItem("testJSON");
obj = JSON.parse(text);
document.getElementById("demo").innerHTML = obj.name;
</script>

Open in new window

summarypage.html
1. how to show everything from json? everything mean name, city, and zip that came from both pages using javascirpt.
2. inside of the myObj = { name:"John Smith", age: 31, city: "New York" } as example.
can I do that below?
{
input.id (e.g. txtname): 'input.value(e.g. txtnamevalue)'
}
I just do not want to hard code the <input> id name inside of the {} because I have so many.
0
Hi I'm using  DataTables to show some point data I had it working now the JSON format has changed I've got most of it fixed except loading the dataTable

From

            $.each(json, function(i, item) {
                console.log(item.id + " Long Lat " + item.Long + ', ' + item.Lat);

Open in new window


New

            $.each(json.features, function(i, item) {
    
                console.log(item.attributes.id + " Long Lat " + item.attributes.Long + ', ' + item.attributes.Lat);

Open in new window


How might I adjust the DataTable code to account for the new JSON data format


OLD Method Th e new data is not available but I've found some similar looking data here
function GetPoints(Long, Lat) {
  //alert("long " + Long + " Lat " + Lat);
  
           var link = "Mock_data.json";
          //          $('#MainTable tbody').html(table);
          var arr=[];
          
         $('#dTable').DataTable({
//           $('#dTable').ajax.reload(),
    "columns": [{ "data": "id" }, { "data": "name" }, { "data": "Lat" }, { "data": "Long" }, {"data": "country_code"},{ "data": "url" }, { "data": "description" }],
    "ajax": {
        "url": link,
        "dataSrc" : function (json) {

//new
            $.each(json.features, function(i, item) {
    
                console.log(item.attributes.id + " Long Lat " + item.attributes.Long + ', ' + item.attributes.Lat);

}// End gGetPoints

Open in new window

0
Hi
I'm trying to loop through some JSON data on a closed system so I can't upload a sample
Could someone give me a clue where to start?

                $.ajax( {
                                url : link,
                                type : 'get',
                                datatype: json,
                                success : function( resp ) {
                                                console.dir(resp);
                                                var elm;
                                                $.each(resp.features, function(key, value){
                                                                elm.append('<tr />');
                                                                $.each(value.attributes, function(key, value){
                                                                                elm.append('<td>' + key.name + ‘</td>’ …);
                                                                });
                                                });
                                                elm.appendTo('#Results');

                                }
                });

Open in new window


CONSOLE output
displayFieldName: "SORT_NAME"
features:Array[1000]
                0:Object
                attributes:Object
           NAME: "My place"
           LONG_: 123
           LAT: 56
...........
   length: 1000
fieldAliases: Object
      NAME: NAME
      LONG_: LONG
      LAT:LAT

Open in new window

0

JSON

860

Solutions

843

Contributors

JavaScript Object Notation, or JSON, is human-readable text used when transmitting data objects consisting of attribute:value pairs between a server and a web application as an alternative to XML. JSON, while it is originally derived from JavaScript, is a language-independent data format. Code for parsing and generating JSON data is available in many programming languages.