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

Hello All

As you can see from the image below, categorizing my data based on Program Type isn't working very well.  Some of the Program Type values are under the wrong category/section.  See below
Here's the code
var jsonData = [{
  "ProgramType": "Construction",
  "Contracts": "27d:bbc1:80db:ea0f:728a:d5db:2651:2681/93",
  "ProjectNumber": "00-438-1489",
  "Award": "Yuan Renminbi",
  "Date": "6/15/2017"
}, {
  "ProgramType": "Construction",
  "Contracts": "ce6b:e4a8:ebb8:8b01:e07f:14f9:8eed:6a6a/11",
  "ProjectNumber": "48-710-7372",
  "Award": "Manat",
  "Date": "8/13/2017"
}, {
  "ProgramType": "Design",
  "Contracts": "dfba:c157:1ec:b60f:4329:91e7:5bdb:316f/114",
  "ProjectNumber": "51-508-3050",
  "Award": "Real",
  "Date": "3/16/2017"
}, {
  "ProgramType": "Study",
  "Contracts": "9c3c:6047:cfc3:1301:b92b:fd6f:87b6:3de7/89",
  "ProjectNumber": "68-285-8596",
  "Award": "Rupiah",
  "Date": "3/21/2017"
}, {
  "ProgramType": "Design",
  "Contracts": "afcf:befe:d329:c6d:8a5e:b528:75b9:9d0b/14",
  "ProjectNumber": "02-108-8005",
  "Award": "Yuan Renminbi",
  "Date": "6/21/2017"
}, {
  "ProgramType": "Commissioning",
  "Contracts": "6e90:bafb:1806:92b7:80aa:911c:b6d7:eadc/32",
  "ProjectNumber": "90-824-1407",
  "Award": "Peso",
  "Date": "9/30/2017"
}, {
  "ProgramType": "Design",
  "Contracts": "b410:353b:d353:1c4d:7924:676:5260:7656/40",
  "ProjectNumber": "70-912-7446",
  "Award": "Denar",
  "Date": "12/13/2016"
}, {

Open in new window

Hire Technology Freelancers with Gigs
LVL 10
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.


The question below was generated by needing to document a JSON structure, but I suppose it could apply to other data formats as well.

Suppose I have a structure:
   name: "John Doe",
   address: "1234 Main Street",
   vitals: {
       hair_color: "brown",
       eyes: "blue",
   DOB: "01-01-2000",
   sex: "Male"  

Normally, I'd create a table with one row per data element. But, then I have the vitals block, which contains two data elements. Should I create a separate table for vitals, even though it contains only two fields? And reference it in the main table?

Hello Support

The attached download enables the ability to convert JSON file format to HCL format (which is developed by a company called Hashicorp.

There is a readme included in the download to describe how to carry out the conversion. However, the demonstration shows how to carry out the conversion in Linux. Unfortunately, I don't know Linux. Therefore, I was wondering if someone could show me how to carryout the conversion in Windows? If not, if someone to talk me through in simple terms how to carry out the conversion in Linux that would also be great - but as I mentioned I'm not a Linux person.

Your assistance will be greatly appreciated.


Hello Support,

I'm trying to convert Azure JSON file to Terraform TF file.

I was directed to the following linkg:


From this link I am instructed to download the appropriate release from this link:


I downloaded


However, I'm not sure how to make it work. Can someone show me please?

I don't understand why I get undefined below.

var index = -1;
var proj = "893x-3owe34p";

function getIndex(val){
var filteredObj = jsonFile.Result.Contracts.find(function(item, i) {
  if (item.Plan.Identification.PlanNumber == val) {
    index = i;
    return index;
  //return index;


Open in new window

How can I retrieve the index of a JSON array?  In my json, there's a PlanNumber with a value and I need to retrieve the index.  The Json in my fiddle show 5 contracts and each having a plan number.

Not working for me.
var index = -1;
var val = "8930-3o3pp";
var filteredObj = jsonFile.Result.Contracts.find(function(item, i){
  if(item.Plan.PlanNumber === val){
    index = i;
    return i;

alert(index, filteredObj);

Open in new window

Hi All,

I am trying to do some things with JSON that I have coded in jsfiddle.  When "PROJ123" is entered into the "Project Number" field, the "Plan Number" drop down box gets populated with corresponding values.  When it gets populated though, I want the default value to be blank.  How do I do that?

Also, I want the corresponding contract type to populate <span id="contractType"></span> based on the "Plan Number" selected.
Here's how to get the contract type Contracts[x].Plan.Info.ContractType from JSON.

<table border="1" width="65%" style="background-color:#eeeeee">
  <tr style="background-color:#00558D;color:white;font-weight:bold;font-size:14px">
    <td colspan="4">New Contract</td>

  	<td>Project Number</td>
  	<td colspan="3"><input type="text" value="" id="projectNumber"></td>

  	<td>Plan Number</td>
  	<td colspan="3">
  		<select id="planNumber">
  			<option value=""></option>
  		</select><span id="contractType"></span>

Open in new window

function getPlanNumbers(projNumber){

var planNumber = [];
var y=0;
var pNumOption = document.getElementById("planNumber");

for (var x=0; x<jsonFile.Result.Contracts.length; x++){
if (jsonFile.Result.Contracts[x].Plan.Info.ProjectNumber === projNumber){
if (jsonFile.Result.Contracts.length == y){
alert("Project Number '"+ projNumber + "' does not exist.");
for(var i=0; i<planNumber.length; i++){
var option = document.createElement('option');
option.value = planNumber[i];
option.innerHTML = planNumber[i];


// alert("populate dropdown");

Open in new window

The actual JSON can be found at this jsfiddle with the rest of the code.
I trying to read the attached jSon response. Also attached is the class that I am using. Below is the code to load the response in a collection so I can populate a datagrid.

Dim docs2 = JArray.FromObject(parsedObject("enrollments")).Select(Function(x) x.ToObject(Of jSonClass.enrollments)())
            Dim empList As New System.Collections.Generic.List(Of jSonClass.enrollments)
            empList = docs2.Select(Function(x) x).ToList

I am getting the error on the last line. "Object reference not set to instance of an object.
My jQuery autocomplete works for the IP Address listed here

However it does not work for the server address here https://consolidatedutilities.com/rates/index2.php
I need some help w/ jquery validate plugin - here is the jsfiddle:


My use case is to make sure the user has selected from the drop down, filled out the 2 text boxes (Number & Book Name), do a remote call for value entered in Book Name, which will return a json object like so: [{"success": false, "IsDuplicate":true}] - in this case, since the "IsDuplicate" is true, it means that the book name already exists in the database and user has to be prompted that a different name has to be entered.

Once all the validations are successfully completed, then the "targetDiv" div has to be set to displayed (which is currently hidden). All these validations need to be done onBlur or something similar to this:


 I've searched extensively to find a working jsfiddle but have not been able to find anything that works for me. Can my use case be achieved via jquery validate plugin, or, do I need to build custom validation?
What’s Wrong with Your Cloud Strategy ?
LVL 10
What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

This is working on my local machine. When I uploaded it to the server to see how fast load times would be with our current server I found out it's not working.

The URL is rates2.php
To view the JSON I'm printing out go to selections.php

To view the jQuery go to rates.js
I have a jQuery autocomplete where it is populated a JSON file with a label and a value.

Can someone write a event handler in my script that will call a function and alert the value when it is selected from the autocomplete?

$(document).ready(function() {
        source: "../js/selections.php"

Open in new window

Anybody know why the onchange() isn't working?  This is the error I get
Uncaught ReferenceError: getProj is not defined
    at HTMLSelectElement.onchange


<select id="contracts" onchange="getProj(this)">
  <option value=""></option>
<span id="ctType"></span>

function getProj(sel) {
var ct = document.getElementById("ctType");
ct.innerHTML = contractAry[2].contractType;

Open in new window

HI experts,
could you suggest few products which can create stunning colorful and appealing UI design for Web and possible for IPad and Mobile.
 Which can read json msg and render UI.

Please advise

Similiar to below


I have a series of pictures and I would like to convert it to a json file so I can use it in an app.
How would I convert or make these as json file
Hello All,

I get the following error as I try to read a certain node from the json below.  This alert gives the highlighted error:

"Cannot read property 'VendorBusinessType' of undefined"

  "Result": {
    "Contracts": [
        "Scope": {
          "Identification": {
            "PlanNumber": "8930-3o3pp"
          "Info": {
            "Title": "chjdj",
            "ProjectNumber": "PROJ123",
            "StationCode": "STATIONCD1",
            "ContractType": "Commodities",
            "ActionType": "chvj-PLAN"
          "Dates": {},
          "Financial": {
            "PlannedFunding": 20000
          "Status": {
            "PlanStatus": "Draft",
            "DateOfLastPlanStatusChange": "/Date(1393887495760-0000)/"
        "Solicit": {
          "Identification": {
            "SolicitationNumber": "svzst-11-Q-xxx"
          "Info": {
            "Title": "vchdsxx",
            "ProjectNumber": "PROJ123",
            "StationCode": "STATIONCD1",
            "ContractType": "Architecture/Engineering – Minor",
            "ActionType": "FSS-RFQ"
          "Dates": {
            "DateIssued": "/Date(1393826400000-0000)/" /*Mon Mar 03 2014 01:00:00 GMT-0500 (Eastern Standard Time)*/,
            "ResponseDueDate": "/Date(1394427600000-0000)/"
           /*Mon Mar 10 2014 01:00:00

Open in new window

I've got a problem that needs solving and it involves the function that you see below. I'm trying to get to a place where I can understand every line of the code and I would appreciate some confirmation on what I THINK I understand. In other instances, I'm just plain stuck.

Here's what I've got:

    function filterInit(){ // Init means I'm starting this as soon as the page initializes
        $('select').material_select(); // I don't know what "material_select" means

        $.ajax({ //this is what's happening when the user clicks on the "select" - you've got an AJAX request being triggered
            'url': '/admin/library/get-tags', // the URL of the code that's returning data
            'data': {
                'filtered': true // don't know what the significance of this is
            'dataType': 'JSON', // data type is JSON
            'success': function(resp){ // if there's data being returned, then do the following
                // remove everything but the default option since it acts as the label for material_select()
                $('#filter-tags option:not([value=""])').remove(); // if the value is blank, remove it
                $('#filter-tags-default option:not([value=""])').remove(); //if the value is blank, remove it

                // add the tags as options
                for (var i in resp.data) { //populating the select with options, but I don't understand the next two lines
                    var $select …
Hi Experts,

Can you help me out please.  I have a JSON field array which I would like exploding into a MSSQL view.  The array is multi level.  I have tried using  JSON_VALUE(fieldname, '$.col1j') for example but because of the multi level array, it doesnt seem to work.  Any ideas would be greatly appreciated....
Ideally the result would be one tale with multiple lines for the same level 1 record with multiple level 2 rows

Here is the example JSON field :-



I was given an API by my client and as I was working with the API (several weeks), I notice that sometimes a node that was there before wouldn't be there at another time.  
For example, "widget.window.title" could be missing next week.

{"widget": {
    "debug": "on",
    "window": {
        "title": "Sample Konfabulator Widget",
        "name": "main_window",
        "width": 500,
        "height": 500
    "image": { 
        "src": "Images/Sun.png",
        "name": "sun1",
        "hOffset": 250,
        "vOffset": 250,
        "alignment": "center"
    "text": {
        "data": "Click Here",
        "size": 36,
        "style": "bold",
        "name": "text1",
        "hOffset": 250,
        "vOffset": 100,
        "alignment": "center",
        "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;"

Open in new window

How can I check if a node exist using javaScript before attempting to use it?
Ask an Anonymous Question!
LVL 10
Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

CheckBox[] boxes = new CheckBox[6];
            boxes[0] = checkBox1;
            boxes[1] = checkBox2;
            boxes[2] = checkBox3;
            boxes[3] = checkBox4;
            boxes[4] = checkBox5;
            boxes[5] = checkBox6;
            // C#
            // Set to details view.
            listView1.View = View.Details;
            // Add a column with width 20 and left alignment.
            listView1.Columns.Add("Instrument", 65, HorizontalAlignment.Left);
            listView1.Columns.Add("Bid", 65, HorizontalAlignment.Left);
            listView1.Columns.Add("Ask", 65, HorizontalAlignment.Left);
            listView1.Columns.Add("Last Price", 65, HorizontalAlignment.Left);

            string bal = RetrieveAccountBalance();

            var y = JsonConvert.DeserializeObject<List<AccountDetail>>(bal);

            for (var i = 0;i <= 6; i++)

                 if (boxes[i].Checked)
                    var s = boxes[i].Tag;

                    string x = "/market/" + s +"/AUD/tick";
                    string o = GetMarketTick(x); //{"bestBid":354.0,"bestAsk":356.89,"lastPrice":356.99,"currency":"AUD","instrument":"ETH","timestamp":1506254860,"volume24h":1183.241}

                    var h = JsonConvert.DeserializeObject<List<TickDetail>>(o);
                    for (var z = 0; z < h.Count; z++)
                        string[] row = { h[z].instrument, h[z].bestBid, h[z].bestAsk, h[z].lastPrice };

Open in new window

Hello Experts

I am getting a json response from a URL which I am trying parse it and capture code to store in the DB

Its returning the string ok but I am unable to remove the quoted strings to save the code in the DB

 Dim jResults As Object = JObject.Parse(Json)
        Dim jsonResulttodict = JsonConvert.DeserializeObject(Of Dictionary(Of String, Object))(Json)
        Dim firstItem = jsonResulttodict.Item("error")
        Dim seconditem = jsonResulttodict.Item("success")
        Dim thirditem = jsonResulttodict.Item("codes")

example string:

'{"error":"","success":"1 code generated successfully","codes":["QTESTA2HLT"]}

I am getting the code as [{  "QTESTA2HLT"  }]

Al I want is to read as QTESTA2HLT

please advise

Hi ,

I am creating a simple component in Angular 4

-my-account  // angular project folder
----account  // angular component folder

//css , js , images are folders I created and put files.

Now I want to use css files from the above css folder in account.component.html.  How do I access ?

Here is my non working code

 <Link href="css/datatables.min.css" rel="stylesheet" type="text/css"/>
 I'm getting error
 zone.js:2744 GET http://localhost:4200/css/datatables.min.css 404 (Not Found)

please note this file is already present in css folder.
Do you have any suggestion how to access css files in component html   ?  what is the proper way to fix ths issue ?
Need help
I am trying to deserialize a string:


But it errors

The code I am using is
private void startToolStripMenuItem_Click(object sender, EventArgs e)
           string bal = RetrieveAccountBalance();
            AccountDetail Details = JsonConvert.DeserializeObject<AccountDetail>(bal);
       #region Account Methods

 public class AccountList
            public List<AccountDetail> data { get; set; }

        public class AccountDetail
            public string balance { get; set; }
            public string pendingFunds { get; set; }
            public string currency { get; set; }

Open in new window

Could anyone help with this error
A 3rd party provider is sending json back to me in this format.


When I execute $json = json_decode($response,true); the last value is not being picked up. How do I read the false statement at the end?

I can get the value of key by using $key = $json->key; but found won't show it's value.
Python Gurus--

I am utilizing a 3rd-party API which returns the data I'm looking for in JSON--however, there is a u'foo' in front of everthing. Maybe a unicode thing?  I want to extract the elements to toss into a tabe that has the same element names.

Here's what I am getting:

[{u'comment': u'', u'enableSpeedWarning': False, u'major': 17, u'licensePlate': u'', u'enableMustReprogram': False, u'immobilizeArming': 30, u'engineVehicleIdentificationNumber': u'1XPBDP9X3GD301269', u'isActiveTrackingEnabled': False, u'workTime': u'WorkTimeStandardHoursId', u'isReverseDetectOn': False, u'brakingWarningThreshold': -34, u'gpsOffDelay': 10, u'minAccidentSpeed': 3.0, u'serialNumber': u'G7DF20DBD6F6', u'timeToDownload': u'1.00:00:00', u'maxSecondsBetweenLogs': 200.0, u'isSpeedIndicator': False, u'id': u'b18', u'customParameters': [], u'hardwareId': 551278326, u'name': u'1579', u'activeFrom': datetime.datetime(2017, 7, 31, 18, 13, 27, 296000, tzinfo=<UTC>), u'corneringWarningThreshold': 26, u'deviceType': u'GO7', u'disableBuzzer': False, u'accelerometerThresholdWarningFactor': 0, u'speedingOff': 90.0, u'minor': 59, u'productId': 109, u'odometerOffset': 0, u'isDriverSeatbeltWarningOn': False, u'deviceFlags': {u'isGarminAllowed': True, u'isOdometerAllowed': True, u'isTripDetailAllowed': True, u'isIridiumAllowed': True, u'isEngineAllowed': True, u'isVINAllowed': True, u'activeFeatures': [], u'ratePlans': [], u'isActiveTrackingAllowed': True, u'isUIAllowed': True, u'isHOSAllowed': …






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.

Related Topics