[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

JSON

784

Solutions

783

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

I'm trying to learn about web APIs and was wondering if you could help me with a simple one to retrieve information about an online image.  An example URL could be
https://www.google.co.uk/imgres?imgurl=https%3A%2F%2Fvignette.wikia.nocookie.net%2Fjurassicpark%2Fimages%2F7%2F74%2FApatosaurus.png%2Frevision%2Flatest%3Fcb%3D20150103191434&imgrefurl=http%3A%2F%2Fjurassicpark.wikia.com%2Fwiki%2FApatosaurus&docid=inqHuw-Ju5m40M&tbnid=rDDyWwT3vIXnGM%3A&vet=10ahUKEwiD34KBu5LeAhUkJMAKHb9gADEQMwhqKAIwAg..i&w=1288&h=540&bih=969&biw=1920&q=apatosaurus&ved=0ahUKEwiD34KBu5LeAhUkJMAKHb9gADEQMwhqKAIwAg&iact=mrc&uact=8

How could I build a RESTful API which accepts the image url as a parameter and retrieve information about the image must be retrieved responding in JSON format.  Is it also possible to create a web client to call the API.  It only needs a single page to accept input for the url, a button to call the API, and an area to display the response.

I'm using C# within Visual Studio 2017 community edition.
0
Introduction to Web Design
LVL 12
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

Hello -

I need help formatting a sharepoint column with JSON.  I am using O365 which allows custom formatting of columns using JSON.  I need to keep the column format as a number format (cannot use text format) and need to basically replace the thousands comma with a hyphen.  So, a number like 18,212 would show up at 18-212.

Again, I can't change the column format to be text.  I have very limited experience with JSON, so any help would be appreciated.
0
Hi, I have a python script that is creating a DataFrame from some json data.
I can create a DataFrame (df) from the data, but I need to create a DataFrame from the 'readings' column within the df DataFrame. My code is failing because the 'readings' column is a list.
Ultimately I need to create a DataFrame with the two DataFrames combined:

DataFrame needed
This is the python code I'm working with:

import pandas as pd
import json

data = {  
   'locationId':123546987,
   'parameters':[  
      {  
         'parameterId':'11',
         'unitId':'81',
         'customParameter':False,
         'readings':[  
            {  
               'timestamp':1538957700,
               'value':2306.078
            },
            {  
               'timestamp':1538959500,
               'value':2305.892
            },
            {  
               'timestamp':1538961300,
               'value':2305.981
            }
         ]
      },
      {  
         'parameterId':'1',
         'unitId':'1',
         'customParameter':False,
         'readings':[  
            {  
               'timestamp':1538957700,
               'value':25.575
            },
            {  
               'timestamp':1538959500,
               'value':25.572
            },
            {  
               'timestamp':1538961300,
               'value':25.575
            }
         ]
      }
   ]
}
         
val = json.loads(json.dumps(data))

val1 = val['parameters']

#val2 = [{'timestamp': 

Open in new window

0
How do I extract parent values and all child values from deserialized JSON, one record per child value, to a List<T>?

Sample JSON:  json_sample.txt

So from the attached sample JSON we wish to add the following records to the  list:
Record 1:  aen: Y456789, studentID: 1016, need: MMM, rank: 1
Record 2:  aen: Y456789, studentID: 1016, need: PPP, rank: 2

All records with "needs : null" to be ignored and all "need": "Not Specified" to be ignored. Sample code below:



      CTFNeedDataBatch =
                           (from people in myJSON.content
                            select new NeedCTF
                            {
                                studID = people.StudentBasic.studentId.ToString(),
                                AEN= people.StudentBasic.aen.ToString(),
                                Code = (people.StudentSensitive.needs == null ? people.StudentSensitive.needs[0].need.ToString() : ""),
                                Priority = (people.StudentSensitive.needs == null ? people.StudentSensitive.needs[0].rank.ToString() : ""),
                            }).Where(w => w.Code != "").ToList();


The problem with this code is we are not getting any values from the "needs" element and even if we were, I doubt we would be getting more than one record from an element that has more than one need.
0
Hi,

Using Python I'm trying to read a json string and output it to a dataframe, but I get the following error:

TypeError: 'float' object is not subscriptable

code is here:
# We import the requests module which allows us to make the API call
import pandas as pd
import ast
import json
import requests

# Call API to pull data
url = 'https://samples.openweathermap.org/data/2.5/weather?q=London,uk&appid=b6907d289e10d714a6e88b30761fae22'

response = requests.get(url = url)
response_data = response.json()

#data = response_data

data = """{  
   'coord':{  
      'lon':-0.13,
      'lat':51.51
   },
   'weather':[  
      {  
         'id':300,
         'main':'Drizzle',
         'description':'light intensity drizzle',
         'icon':'09d'
      }
   ],
   'base':'stations',
   'main':{  
      'temp':280.32,
      'pressure':1012,
      'humidity':81,
      'temp_min':279.15,
      'temp_max':281.15
   },
   'visibility':10000,
   'wind':{  
      'speed':4.1,
      'deg':80
   },
   'clouds':{  
      'all':90
   },
   'dt':1485789600,
   'sys':{  
      'type':1,
      'id':5091,
      'message':0.0103,
      'country':'GB',
      'sunrise':1485762037,
      'sunset':1485794875
   },
   'id':2643743,
   'name':'London',
   'cod':200
}"""

val = ast.literal_eval(data)
val1 = json.loads(json.dumps(val))
val2 = val1['main']['temp'][0]
dataset = pd.DataFrame(val2)
#OutputDataSet=dataset
#print(val1)
print(dataset)

Open in new window

0
I have a PowerShell script which generates JSON output of VM objects in a vSphere environment.   Each VM has a path property which represents the location of the VM in the folder structure.  Rather than the folders be represented in a property, how can I modify the script to use the path value to generate folder objects with the VM objects inside?

PowerShell Example:
$SQL = "USE $SQLDatabase SELECT top 2 * FROM VMs"
$computers = Invoke-sqlcmd -query $SQL -ServerInstance $SQLInstance -Username $SQLUsername -Password $SQLPassword

$connections = @()
$customProperties = @()

ForEach ($computer in $computers) {

    $connection = New-Object pscustomobject -Property @{
        "Type" = $computer.Type;
        "Name" = $computer.Name
        "ComputerName" = $computer.ComputerName
        "Path" = $computer.$path

    }
    $connections += $connection
}

@{
    Objects = $connections
} |
ConvertTo-Json -Depth 100 |
Write-Host]

Open in new window


Current Output Example:
{
  "Objects": [
    {
      "Path": "Clients A-K/Client 1 (ACC)",
      "ComputerName": "VM1",
      "Name": "VM1",
      "Type": "TerminalConnection"
    },
    {
      "Path": "Clients A-K/Client 1(ACC)",
      "ComputerName": "VM2",
      "Name": "VM2",
      "Type": "RemoteDesktopConnection"
    }
  ]
}

Open in new window



Goal Output Example:
{
  "Objects": [
    {
      "Type": "Folder",
      "Name": "Clients A-K",
      "Objects": [
        {
          "Type": "Folder",
          "Name": "Client 1 (ACC)",
          "Objects": [
            {
              "Type": "TerminalConnection",
              "Name": "VM1",
              "ComputerName": "VM1",
            },
            {
              "Type": "RemoteDesktopConnection",
              "Name": "VM2",
              "ComputerName": "VM2",
            }
          ]
        }
      ]
    }
  ]
}

Open in new window

0
How to order below json by Location , Name ="Total" comes before detail

{
   "records":[
      {
         "Location":"UK",
         "RecordType":"Fruits",
         "Qty":16,
         "Name":"Total"
      },
      {
         "Location":"UK",
         "RecordType":"Grocery",
         "Qty":11,
         "Name":"Total"
      },
      {
         "Location":"US",
         "RecordType":"Fruits",
         "Qty":5,
         "Name":"Total"
      },
        {
         "Location":"US",
         "RecordType":"Grocery",
         "Qty":17,
         "Name":"Total"
      },
      {
         "Location":"US",
         "RecordType":"Fruits",
         "Productid":123,
         "Qty":5,
         "Name":"Apple"
      },
      {
         "Location":"UK",
         "RecordType":"Fruits",
         "Productid":124,
         "Qty":11,
         "Name":"Bananna"
      },

      {
         "Location":"US",
         "RecordType":"Grocery",
         "Productid":223,
         "Qty":6,
         "Name":"Rice"
      },
      {
         "Location":"UK",
         "RecordType":"Grocery",
         "Productid":224,
         "Qty":11,
         "Name":"Beans"
      }
   ]
}

Open in new window




How to rearrange json so Location + Total comes before detail

{
   "records":[
      {
         "Location":"UK",
         "RecordType":"Fruits",
         "Qty":16,
         "Name":"Total"
      },
      {
         "Location":"UK",
         "RecordType":"Fruits",
         "Productid":124,
         "Qty":11,
         "Name":"Bananna"
      },
      {
         "Location":"UK",
         "RecordType":"Grocery",
         "Qty":11,
         "Name":"Total"
      },
      {
         "Location":"UK",
         "RecordType":"Grocery",
         "Productid":224,
         "Qty":11,
         "Name":"Beans"
      },
      {
         "Location":"US",
         "RecordType":"Fruits",
         "Qty":5,
         "Name":"Total"
      },
      {
         "Location":"US",
         "RecordType":"Fruits",
         "Productid":123,
         "Qty":5,
         "Name":"Apple"
      },
        {
         "Location":"US",
         "RecordType":"Grocery",
         "Qty":17,
         "Name":"Total"
      },
      {
         "Location":"US",
         "RecordType":"Grocery",
         "Productid":223,
         "Qty":6,
         "Name":"Rice"
      }
   ]
}

Open in new window

0
How to build table using javascript for below JSON , I want to display Total for each location and RecordType first and then detail for location and recordtype and add extra blank row for each different category


{
   "action":"query",
   "Warehouse":"NJ",
   "records":[
      {
         "Location":"UK",
         "RecordType":"Fruits",
         "Qty":16,
         "Name":"Total"
      },
      {
         "Location":"UK",
         "RecordType":"Grocery",
         "Qty":11,
         "Name":"Total"
      },
      {
         "Location":"US",
         "RecordType":"Fruits",
         "Qty":5,
         "Name":"Total"
      },
        {
         "Location":"US",
         "RecordType":"Grocery",
         "Qty":17,
         "Name":"Total"
      },
      {
         "Location":"US",
         "RecordType":"Fruits",
         "Productid":123,
         "Qty":5,
         "Name":"Apple"
      },
      {
         "Location":"UK",
         "RecordType":"Fruits",
         "Productid":124,
         "Qty":11,
         "Name":"Bananna"
      },

      {
         "Location":"US",
         "RecordType":"Grocery",
         "Productid":223,
         "Qty":6,
         "Name":"Rice"
      },
      {
         "Location":"UK",
         "RecordType":"Grocery",
         "Productid":224,
         "Qty":11,
         "Name":"Beans"
      }
   ]
}

table
Location  Name   RecordType    ProductID, Qty
US        ,Total   ,Grocery    ,          ,6
US       …
0
Hi Experts,
Need some urgent help on quering json object please


1. How to query attached json file and return true or false based on string contains logic check.
2. Parse each stdout element in the json file.
3. Loop through each stdout and check for if it contains "HELLOWORLD_APPLICATION_DEPLOYMENT_SUCCESSFUL"

below filter will return all stdout element. but not able to figure out how to include contains logic and get true/false
jpath = plays[*].tasks[*].hosts.localhost.stdout


Have attacehd few screenshot on how i'm trying this online json editor

https://jsoneditoronline.org/
json_editor1.jpg
json_editor2_with_filter.jpg
success.json
0
Hello Sirs
I am using serious issues with Charset Encoding in a REST application. I use Spring and the encoding in the bean MessageSource and Tymeleaf resolver  is set to UTF-8.
I get this when I return Json string:
\ufffd replacing special characters like é, or any other letter with accent.
How can I solve this?

Best regards.
0
HTML5 and CSS3 Fundamentals
LVL 12
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

Extracting API Data Using Python and Loading into SQL Server

Hi,
I am new to Python in SQL Server. I'd like to load json data from an API into SQL Server, I thought the best way to do this is to utilise the new SQL Server Machine Learning Services with Python.

I can call the API and print the json data in SSMS:

execute sp_execute_external_script 
@language = N'Python',
@script = N'

# We import the requests module which allows us to make the API call
import pandas as pd
import json
import requests
 
# Call API to pull data
url = ''https://samples.openweathermap.org/data/2.5/weather?q=London,uk&appid=b6907d289e10d714a6e88b30761fae22''

response = requests.get(url = url)
response_data = response.json()

print(response_data)
'

Open in new window


I'm pretty happy using the JSON functions in SQL Server to format and parse the data into SQL tables, but with Python how do I read/access the json data from the response into an TSQL query?

Thank you
0
Hello there.

I am trying to make server pagination work for:
http://bootstrap-table.wenzhixin.net.cn/documentation/

My backend is Python Flask and I have this function preparing the data.
It works but I cannot understand how to paginate it...
The parameters that I receive from fronteng get call are the ones you see:
@app.route('/json/items')
def get_items():
    """
    Return a JSON containing all items
    """
    order = request.args.get('order')
    offset = request.args.get('offset')
    limit = request.args.get('limit')
    items = db.session.query(Item).all()
    return jsonify([i.serialize for i in items])

Thanks for you help and patience.
0
What is the syntax for a LINQ query that would get the first value from a JSON child node. I'm trying to get the first value in the "aenHistory" element in the attached JSON sample.

Here is the query that works fine so far apart from the "FormerAEN" element:

                                    studentDataBatch =
                                                  (from people in students.Children().Children()                                                    
                                                   select new studentSIM
                                                   {
                                                       PersonID = (people.SelectToken("StudentBasic.studentId") == null ? String.Empty : people.SelectToken("StudentBasic.studentId").Value<string>()),
                                                       Surname = people.SelectToken("StudentBasic.surname").Value<string>(),
                                                       Forename = people.SelectToken("StudentBasic.firstName").Value<string>(),
                                                       AEN = (people.SelectToken("StudentBasic.aen") == null ? String.Empty : people.SelectToken("StudentBasic.aen").Value<string>()),                                                      
                                                      Sex = (people.SelectToken("StudentBasic.gender").Value<string>()).Substring(0,1),
                                                     …
0
Hi,

is there's a way to consume JSON API in SSRS?  I did some research and I landed to a 3rd party ODBC driver for ZappySys, is there's a free way, as my company won't be paying for a license.

thanks
0
I have two collection
Name and address which i exported as json from relation database

I want to merge that two collection as below how can i do that.


Thanks

I
{
    "_id" : ObjectId("5bba4cadb20b7e2f3c1436fd"),
    "o_id" : 5,
    "surname" : "sam",
    "firstname" : "sam",
    "created_date" : "2018-10-07",
    "address" : {
        "address1" : "177 road",
        "city" : "MI"
    }
}
0
I need the second to last item in the json response at the end of the code to include all the skus in each of the orders (so users can order all of that order's item's again all at once). What I have in there now only returns the sku in the last order. A preview of the current json response is embedded directly below. json
                // Organized Order Products into shipments //
                $shipments = array();
                foreach($order['order_details'] as $prod) {
            	   $grp = $dbAccessor->getShipmentGroup($prod['SKU']);
            	   if(!isset($shipments[$grp])) {
            	      $shipments[$grp] = array();  
            	   }

            	   $shipments[$grp][] = array('sku'             => $prod['SKU'],
                                              'name'            => $prod['Product'],
                                              'qty'             => $prod['qty'],
                                              'url'             => str_replace('http://www.mysite.com', '', $dbAccessor->getProductUrl($prod['SKU'])),
                                              'image_url'       => "/images/sku/small/".$dbAccessor->getSkuImage($prod['SKU']),
                                              'supplier_sku'    => $dbAccessor->getSupplierSku($prod['SKU']),
                                              'is_discontinued' => $dbAccessor->isDiscontinued($prod['SKU']),
                                              'supplier'       

Open in new window

0
msg.topic = "Insert into mytable(DeviceId,Line,outPIN,count,Time) values (?,?,?,?,?)";
msg.payload = [{"DeviceId": 1,
"Line": 1,
"outPIN": "GPIO1",
"count": 15,
"Time": "2018-09-23 08:14:45"},
{"DeviceId": 1,
"Line": 1,
"outPIN": "GPIO1",
"count": 15,
"Time": "2018-09-23 08:15:13"},
{"DeviceId": 1,
"Line": 1,
"outPIN": "GPIO1",
"count": 15,
"Time": "2018-09-23 10:45:36"},
{"DeviceId": 1,
"Line": 1,
"outPIN": "GPIO1",
"count": 15,
"Time": "2018-09-23 10:48:51"}]
return msg;

Open in new window

Error message : msg : error

"Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?)' at line 1"
0
The following is coded in Laravel framework:

QUERY

$shipping = DB::table('shipping')->where('country',$delivery->country)->first();
$data= json_decode(json_encode($shipping),true);

Open in new window


RESULT

array (
  'id' => 3,
  'carrier' => 'EN',
  'country' => 'AU',
  'rates_json' => '{"rates": [{"international": [{"zone4": [{"to_kg": "2", "total": "1", "from_kg": "1"}, {"to_kg": "4", "total": "2", "from_kg": "3"}]}]}]}',
)  

Open in new window


In MySQL database i stored rates_json in a json datatype column. The attribute from_kg and to_kg is a range.  

I intend to retrieve the total if a value is between the range. For instance, if value 1.5 is between  1 and 2 then the total is 1.

Your help is appreciated.

Thank You.
0
Hi,

I've a form to send a ajax request which return a json object from a cURL request. I use the form to query the API using the start and and the end date. I've managed to show the datas returned into a table as suggested in this post https://www.experts-exchange.com/questions/29120674/Convert-json-to-html-table.html
Now my problem is every time a make a new request from my form a new table is shown to the form page just after the table I've obtained with the previous request, is there any way to show only one table, so at every form request the previus data is replaced with the new data?

This is my javascript code:
    $(document).ready(function() {

      // Function to create table layout
      function createTable(data) {
        var table = document.createElement('table');
        var header = table.insertRow();

        for(var h in data[0]) {
          var th = document.createElement('th');
          th.innerHTML = h;
          header.appendChild(th);
        }

        table.classList.add('table','table-bordered');
        data.forEach(function(item) {
          var row = table.insertRow();
          for(var v in item) {
            var cell = row.insertCell();
            if (Array.isArray(item[v])) {
              var subtable = createTable(item[v]);
              cell.appendChild(subtable);
            }
            else {
              cell.innerHTML = item[v];
            }
          }
        })

        return table;
      }

      // 

Open in new window

0
Exploring SQL Server 2016: Fundamentals
LVL 12
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

How can I build html table from json? for negative value I want to bold the row. and display NJ warehouse first then CA
{
"action": "query",
"Time": 12,
"data": [
{
  "Product": "Iphone",
  "Price": 989,
  "Warehouse": "NJ"
},
{
  "Product": "Ipad mini",
  "Price": 429,
  "Warehouse": "NJ"
},
{
  "Product": "Iphone mini",
  "Price": 489,
  "Warehouse": "NJ"
},
{
  "Product": "Galaxy",
  "Price": -1,
  "Warehouse": "CA"
},
{
  "Product": "Galaxy mini",
  "Price": "595.99",
  "Warehouse": "CA"
}
]    
}

Open in new window


The result should be as below, first display all Warehouse=US then Warehouse=CA

US Product Price Warehouse Iphone 989.00 US Ipad mini 429.00 US Iphone mini 489.00 US CA Product Price Warehouse **Galaxy -1 US ** Galaxy mini 595.99 CA
 
   <table width="200" border="1" cellpadding="0" cellspacing="0">
  <tr>
    <td width="100" colspan="3">NJ</td>
  </tr>
  <tr>
    <td width="100">Product</td>
    <td width="50">Price</td>
    <td width="50">Warehouse</td>
  </tr>
  <tr>
    <td>Ipad mini</td>
    <td>429.00</td>
  </tr>
  <tr>
    <td>Iphone mini</td>
    <td>429.00</td>
  </tr>
  <tr>
    <td width="100"  colspan="3">CA</td>
  </tr>
  <tr>
    <td width="100">Product</td>
    <td width="50">Price</td>
    <td width="50">Warehouse</td>
  </tr>
  <tr>
    <td>Galaxy</td>
    <td><B>-1</B></td>
  </tr>
  <tr>
    <td>Galaxy mini</td>
    <td>595.99</td>
  </tr>
</table>

Open in new window

0
I was sending XML in SOAP envelope to a web consuming server here at Lone Star. The Web consuming service has now switched from XML to JSON. Does the SOAP envelope change? If so in what way? I'm attaching the actual output to the Web Service. Using Krengeltech's RPG-XML to generate the XML data formatted and wrapping it in the SOAP envelope. Krengeltech also has a JSON api to perform the data mapping in JSON instead of XML. I need help creating the 'wrapped' soap statements
0
I need to get the following format for serializing XML but not sure how best to handle this.  Element tag needed:

<create-by-workflow>
    <workflow-name>Customer</workflow-name>
</create-by-workflow>

Open in new window


Right now I have two classes as such:

public class WorkflowRequestDto
{
    [XmlElement(Constants.CreateByWorkflowTagName)] //this is     public const string CreateByWorkflowTagName = "create-by-workflow";
    public WorkflowNameDto WorkflowName { get; set; }
}

public class WorkflowNameDto
{
    [XmlElement(Constants.WorkflowNameTagName)] // this is     public const string WorkflowNameTagName = "workflow-name";
    public string WorkflowName { get; set; }
}

Open in new window


The JSON looks like this in Swagger:

"workflowName": {
    "workflowName": "string"
}

Open in new window


Is there a way to have it just be  "workflowName": "string" to the user so something along these lines although this does not work:

[XmlElement(Constants.CreateByWorkflowTagName)] 
[XmlElement(Constants.WorkflowNameTagName)]
public string WorkflowName { get; set; }

Open in new window

0
I have setup Code Pipeline to build a docker instance and deploy it on a ECS cluster, I have created my buildspec.yml and everything is working, however I need to adjust my buildspec.yml to print image definitions that setup a health check but so far its not working. Here is my current code for my buildspec.html

version: 0.2

phases:
  install:
    commands:
      - echo Entered the update phase...
      # Updates Docker Instance
      - apt-get update -y
  pre_build:
    commands:
      - echo Logging in to Amazon ECR...
      - aws --version
      - $(aws ecr get-login --region ap-southeast-2 --no-include-email)
      # ECS Repository URI
      - REPOSITORY_URI=###########.dkr.ecr.ap-southeast-2.amazonaws.com/###########
      - COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
      - IMAGE_TAG=${COMMIT_HASH:=latest}
  build:
    commands:
      - echo Build started on `date`
      - echo Building the Docker image...          
      - docker build -t $REPOSITORY_URI:latest .
      - docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
  post_build:
    commands:
      - echo Build completed on `date`
      - echo Pushing the Docker images...
      - docker push $REPOSITORY_URI:latest
      - docker push $REPOSITORY_URI:$IMAGE_TAG
      - echo Writing image definitions file...
      # Prints Task Definitions
      - printf '[{"name":"website","imageUri":"%s","healthCheck":{"retries":3,"command":["/bin/bash curl -f http://localhost/ || exit

Open in new window

0
json string have parent and child and child has sub child(grand child). Here wanted to remove grand child. child name and grand child name is same so if i remove based on the name it will remove child and grand child.But I wanted to remove only GrandChild property. I have converted json string to JObject here my code snippet: i know this is wrong it deletes both child and grand child because names are same. Please find attached my Json object structure and json string. I am using C#.net. Please let me know if you need any information.

JObject jObject = JObject.Parse(jsonString);
jObject.Descendants()
.OfType<jproperty>()
.Where(attr => attr.Name.Contains("NameofChild"))
.ToList()
.ForEach(attr => attr.Remove());
json-string.txt
jsonStructure.jpg
0
I'm getting this error:
Exception has occurred: UnicodeDecodeError
'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

Using this code:
json_obj = urllib.request.urlopen(url).read() 

response = urllib.request.urlopen(url).read()

json_obj = str(response, 'utf-8')

data = json.loads(json_obj)

Open in new window

0

JSON

784

Solutions

783

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.

Related Topics