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


I have data returned (i presume it is in 'checkout;paymentResult' )

I need to send data to a phpfile 'sum.php' and load the php file

How would I do that ??

                //render the form ui providing a configuration object
                PaymentCard.mount({checkoutId: "<?= $checkoutId ?>","fields_placeholders": {
                  "card_number": "Card number",
                  "cvv": "CVV",
                  "expiry_date": "Expiry date",
                  "pay_now": "Pay £ <?= $amount ?> Now" }});
                //listen to checkout processing result and handle it
                PaymentCard.on('checkout:paymentResult', function (data) {
               // send info to sum.php here


Open in new window

Expert Spotlight: Joe Anderson (DatabaseMX)
LVL 13
Expert Spotlight: Joe Anderson (DatabaseMX)

We’ve posted a new Expert Spotlight!  Joe Anderson (DatabaseMX) has been on Experts Exchange since 2006. Learn more about this database architect, guitar aficionado, and Microsoft MVP.

Having a problem retrieving information from an API.  I keep getting an (403) Forbidden error.

public string GetJsonString(string url)

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

                WebResponse response = request.GetResponse();
                using (Stream responseStream = response.GetResponseStream())
                    StreamReader reader = new StreamReader(responseStream, System.Text.Encoding.UTF8);
                    return reader.ReadToEnd();
            catch (WebException e)
                WebResponse errorResponse = e.Response;
                using (Stream responseStream = errorResponse.GetResponseStream())
                    StreamReader reader = new StreamReader(responseStream, System.Text.Encoding.GetEncoding("utf-8"));
                    string errorText = reader.ReadToEnd();


Open in new window

URL: https://api.weather.gov/points/29.146673,-80.964371

I can't figure out why this API is causing an error.
AJAX JSON Return.  Right now in my script that I am working on, the script returns a JSON response of a variable $response.  I want to also include $verifyResponse.  I'm not 100% sure how to write it.  This is what is in the code:

 comMember_activity_log::post('asa_address_validate', array('response' => $response, 'verifyResponse' => $verifyResponse));

// Respond
  header('Content-Type: application/json');
  echo json_encode($response,  JSON_PARTIAL_OUTPUT_ON_ERROR);

Open in new window

The var $response has half of the info I need.  $verifyResponse has the rest.  This is what the info looks like from the Network console of the JSON return:

{"error":false,"message":"","address":{"Address1":null,"Address2":"Blah Blah Court","City":"Hammond","State":"MS","Zip5":"1111","Zip4":null},"recommended":{"Address1":"Blah Blah Court","Address2":"","City":"Hamond","State":"MS","Zip5":"1111","Zip4":null},"verifyResponse":null}

Open in new window

There is info in the verifyResponse I need.
Parsing nested json. I am looking for help to parsing the nested json elements.

I attached a json file I need to output all of the data fields, however some are nested and I don't know the HOW-TO output the nested values. Can you help ?

I also include the start a python script
I am hoping this is an easy solution that I am just overcomplicating.

1) I have JSON data stored in a hidden div
2) I want to parse that JSON data for a particular record and get a specific value (code) from the record.
3) I want to use a URL parameter called id to filter for that specific JSON record and get the code from the data.
4) below is the code I started putting together but I can't see to successfully figure out how the parse the JSON data for the record I need.
//URL Parametercode
$(document).ready(function() {
if (getParameterByName('id') != '') {
//use ID To get course code
var courseid = getParameterByName('id');

var courseJSONDdata = $("#coursedata").text();
console.log('THIS IS A TEST' + $("#coursedata").text());

//filter by Paramter ID
function filter(courseJSONdata, courseid) {
           var result = [];
           if (courseid)
               result = courseJSONdata.filter(function (item) { return item.dataid == courseid });
           return result;
console.log('RESULT TEST ' + result);

///Load the Data for the Course after Parameter
   LoadQuestions(coursecode, $("#answers").text());
   LoadData(coursecode, $("#coursedata").text());

function getParameterByName(name) {
  var res = new RegExp(
      // Parameter names always start after a ? or &.
      '[\?&]' +

      // Make sure any [ or ] are escaped in the name.
      name.replace(/\[/g, '\\\[').replace(/\]/g, '\\\]') +


Open in new window


I have some JSON data that i'm adding to a DataTable see bellow from here
The "item.attributes.code" entry is A single letter which isn't helpful to the end user

How might I create a Look Up Table that returns the actual value? Something like a perl Hash

In perl the code might look like this
%MyHash= ("A"=> "Foo Bar","B"=> "Bish Bash", "C"=> "This n That");

$code = $MyHash{item.attributes.code};

print "Code: $code\n ";

returns Foo Bar

Open in new window

var Newjson = [];
    url: "https://api.myjson.com/bins/8w0so",
    dataType: "json",
    type: "GET",
  }).then(function(json) {
    json.features.forEach(function(item) {
        id:   item.attributes.objectid,
        city:         '',
        name:         item.attributes.name,
        long:         item.attributes.LONG_,
        lat:          item.attributes.LAT,
        country_code: item.attributes.country_code,
        code:         item.attributes.code,
        url:          item.attributes.url,
        description:  item.attributes.description



  // Set up the DataTable
    // Specify the column data
    columns: [
      { data : "id" }, 
      { data : "city" },
      { data : "long" },
      { data : "lat" },
      { data : "country_code"},
      { data : "code"},
      { data : "url" },
      { data : "description"}
});// end $ function

Open in new window

I have a problem passing a class to another class in java.  Doesn't show an error message.  So I am not sure what's going on.  The file I am inquiring about is called TestJasoncallingMethod.txt.  This is a two part question.  after I create the JSON file I would to like to use it in Java class filling a pdf file.
I am trying to create an array, encode it with json_encode, and then use it as post fields for a curl request but i keep getting "items" invalid.

Here is my code:
$jsonPostArray = array(
                "tracking_number" => $tracking,
                "order_address_id" => $address,
                "shipping_provider" => $shipping,
                "items" => array(
                    "order_product_id" => $productId,
                    "quantity" => $quantity

                $jsonPostData = json_encode($jsonPostArray,true);

Open in new window

and it outputs this below but the api im using returns an error and says items in invalid json? Im thinking it needs the [] brackets somewhere but cant tell how to generate that with PHP.

What am i doing wrong, is it how im building my array or how i am encoding it to json?

    "tracking_number": "88598020014",
    "order_address_id": "6863",
    "shipping_provider": "fedex",
    "items": {
        "order_product_id": "10890",
        "quantity": "3"

Open in new window

Trying to take a json file and upload into a database. First I'm setting up properties to capture the data. This is where I'm stuck at the moment. I have property arrays within property arrays that is returning nothing. not sure what I'm doing wrong. Never worked with a json file before. If you look at the attached text file, Precautions is returning nothing. the file is much larger just working with a chunk at a time. Can someone show me why Precautions data is not returning?
Here is the code so far. Got the form load code from searching. Forgot where to give credit.

Public Class Form2
    Private _desktop As String =

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        Dim filePath As String =
            IO.Path.Combine(_desktop, "UploadFile.txt")

        Dim data As Upload =
            JsonConvert.DeserializeObject(Of Upload)(IO.File.ReadAllText(filePath))


    End Sub

    Public Class Upload
        Public Property Item As String
        Public Property norm As String
        Public Property primaryimage As PrimaryImage()
        Public Property Secondaryimages As secondaryImages()
        Public Property description As String
        Public Property notes As Notes()
        Public Property Precaution As Precautions()
    End Class

    Public Class Precautions
        Public Property Warnings As Warnings()
        Public Property 

Open in new window

do u see anything wrong with this? it returns null for some reasons

public string urlShorter(string url)
            string finalURL = "";
            string post = "{\"longUrl\": \"" + url + "\"}";
            string shortUrl = url;
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.googleapis.com/urlshortener/v1/url?key=" + key);
                request.ServicePoint.Expect100Continue = false;
                request.Method = "POST";
                request.ContentLength = post.Length;
                request.ContentType = "application/json";
                request.Headers.Add("Cache-Control", "no-cache");
                using (Stream requestStream = request.GetRequestStream())
                    byte[] postBuffer = Encoding.ASCII.GetBytes(post);
                    requestStream.Write(postBuffer, 0, postBuffer.Length);
                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                    using (Stream responseStream = response.GetResponseStream())
                        using (StreamReader responseReader = new StreamReader(responseStream))
                            string json = responseReader.ReadToEnd();
                            finalURL = Regex.Match(json, @"""id"": ?""(?.+)""").Groups["id"].Value;

Open in new window

JavaScript Best Practices
LVL 13
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.


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"

            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?

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": [
        "msg": "Atomic document updates are not supported unless <updateLog/> is configured",
        "code": 400

Open in new window

Here's my code:

const fs = require("fs");
const path = require("path");

module.exports = class Product {
  constructor(t) {
    this.title = t;

  save() {
    const p = path.join(
    fs.readFile(p, (err, fileContent) => {
      let products = [];
      if (!err) {
        products = JSON.parse(fileContent);
      fs.writeFile(p, JSON.stringify(products), err => {

  static fetchAll() {
    return products;

Open in new window

The error that I'm getting is:

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at fs.readFile (C:\wamp\www\adm\node\express_tutorial\models\product.js:18:25)
    at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
[nodemon] app crashed - waiting for file changes before starting...

This is line #18: products = JSON.parse(fileContent);

Two questions: First of all, what am I missing that would result in the error that I'm getting?

Secondly, what is "18:25?" I'm referring to the actual error message. "18," I'm assuming, is line #18, but what is "25?"

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
I need to be able to run the following in visual studio using vb.net. :

# Use the command below to dump the JSON data for your orders. Replace the `2c493d74` with your own API key (which will be much longer)
curl -u 2c493d74:X "https://app.handshake.com/api/latest/orders"

Make sure to replace the 2c493d74 with your own API key.
I downloaded https://curl.haxx.se/download.html and it does run

I have been playing about with code like the following as well.

   Dim credstring As String = "apikey:X"
            Dim authstring As String = Convert.ToBase64String(Encoding.UTF8.GetBytes(credstring))

            Dim webrequest As WebRequest = webrequest.Create("https://app.handshake.com/api/latest/orders")

            With webrequest
                .Headers.Add("Authorization", "BASIC " & authstring)

                Dim webresponse As HttpWebResponse = .GetResponse() '

                Dim stream As System.IO.Stream = webresponse.GetResponseStream()
                Dim reader As New StreamReader(stream, Encoding.UTF8)
                Dim contents As String = reader.ReadToEnd()
            End With

Just looking for the easiest solution. Been searching for CLIB integrations into vb.net.

Best Regards,

For sending requests to a webservice that deserializes Json, what items in this list are 'required' by the webservice?

# 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:
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
I'm looking for some good learning resources for Json and Java to shorten some tasks.  Also looking for something on Node and Java.  Any suggested books or websites to learn this stuff?  By the way what application does Json and Node have?

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.


Why Diversity in Tech Matters
LVL 13
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

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

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.

I have JSON string looking like this:
         "due_date":"0000-00-00 00:00:00",
         "last_event":"2019-03-07 14:42:59",
         "reminder_dates":"0000-00-00 00:00:00",
         "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\":\"\"}",
         "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",
         "recipients":"[{\"email\":\"nordberg.peter@gmail.com\",\"full_name\":\"MUSICCENTER SKARA AB\"}]",

Open in new window

 "id": "169535ddb258a889",
 "threadId": "1695350fe63f9f3a",
 "labelIds": [
 "snippet": "this is a test On Wed, 6 Mar 2019 at 14:03, &lt;alextestemail21@gmail.com&gt; wrote: Hello ( user ) Thank you for filling in our form, if you have any questions please feel free to contact me on this",
 "historyId": "20762",
 "internalDate": "1551881841000",
 "payload": {
  "partId": "",
  "mimeType": "multipart/related",
  "filename": "",
  "headers": [
    "name": "Delivered-To",
    "value": "alextestemail21@gmail.com"
    "name": "Received",
    "value": "by 2002:ab0:7509:0:0:0:0:0 with SMTP id m9csp5885537uap;        Wed, 6 Mar 2019 06:17:34 -0800 (PST)"
    "name": "X-Received",
    "value": "by 2002:a2e:12da:: with SMTP id 87mr2575789ljs.181.1551881853887;        Wed, 06 Mar 2019 06:17:33 -0800 (PST)"
    "name": "ARC-Seal",
    "value": "i=1; a=rsa-sha256; t=1551881853; cv=none;        d=google.com; s=arc-20160816;        b=q7Ps0TS3Z/E88kwwhmJyMzyi6CXgW8iAgOFF68UPoBHDBW13fcl4G83CvLXyxteSG3         k4Js2xpLxF5tw4XIZQIODYNfvzx1wjs3vk8J9XYE58jzjujQRiM9rOZGSGB9Cn3n8ifP         CfLRPwHsv6KjReJ6b6bCABD14DkbX8VzQ7MZ9YWjj0x1YtLW2iAjCxfcBSwR8CHeJ3V7         VUfF8dPsMBGG5Wrwbp3lyDak6zZS7JbysKtmSIhgBoVbUvSU6UFlB3bo/Rfffex+zQFQ         HkGjnp0OxBsEKRb4MGlTYI2QIrS/BFbpMsHLyBizAz4Sgt4ZW88MTlc57st8WBcjmvPF         avsg=="
    "name": "ARC-Message-Signature",
    "value": "i=1; 

Open in new window

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",
            "cause": false
            "chip": "2018.02.05.192",
            "start_date": "2018-02-05T15:48:08",
            "end_date": "2018-02-05T17:22:34",
            "co_num": [
            "cause": false
            "chip": "2018.02.05.26",
            "start_date": "2018-02-05T16:38:56",
            "end_date": "2018-02-05T21:08:00",
            "co_num": [
            "cause": false

Open in new window

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.


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


Loop through line_items in this transaction


Do this if the item is a download


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...





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

Open in new window







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.