Questions tagged [json]

61545 questions
1

votes
2

answer
170

Views

How to recognize data format - scraping in R

I am trying to use R to get data from an open data source in the Netherlands. The source is here. When you open this in a browser (at least Chrome), it is presented as xml code. So I thought I can use the RCurl package to parse it, and then use XPath to extract the specific nodes I seek. However, wh...
user2652572
1

votes
2

answer
1.1k

Views

Accessing stringified JSON objects

As another user in my other thread suggested to post another question here in regards to explaining how to access JSON Objects. The code I am using is: $(function () { $.getJSON( "https://api.guildwars2.com/v1/wvw/matches.json", function (data) { $("#reply").html(JSON.stringify(data)); // or work wi...
user2593573
1

votes
2

answer
699

Views

needed: simple way to force json to decode to “normal” iterable python lists

I've stackoverflow a ton and never found the need to ask a question before, and while there are a lot of threads on this subject, I can't seem to find something that is easy and makes sense. If I have somehow missed something, please provide a link. Here goes: I am trying to pass lists back and...
domoarigato
1

votes
1

answer
758

Views

Cleaning data with R [closed]

I am new to R, but I am trying to manipulate data in a JSON format. I can get the data into by using Rstudio's import function, but I have having trouble converting it into a table. the string read like this. 'type': 'business', 'business_id': (encrypted business id), 'name': (business name), 'neig...
SJSU2013
1

votes
1

answer
1.6k

Views

Google Calendar API V3 - Insert Calendar

I am playing around with Google calendar API and came across this: Google Calendar V3 Insert The Ruby code doesn't seem to be Ruby code so I ported information from the calendar_list and calendar.get to this. I'm not sure why the parameter summary is not being picked up as a title. def create...
ebbflowgo
1

votes
1

answer
4.1k

Views

Dealing with optional field in json

I have am trying to parse a json with following format JSONObject json; try { json = (JSONObject)parser.parse(value.toString()); String foo = (String) json.get("foo").toString();//error here String id1 = (String) json.get("_id"); JSONArray array = (JSONArray)json.get("bar"); } catch (ParseException...
Fraz
1

votes
1

answer
924

Views

Http POST request of json data and null values

what is the difference in a json request I make wrt to a field 'a' for a POST [{"a",}, // Here I don't specifiy a value for a, Is this treated as null ? {"a":1},// Here I specify a value for a which is 1 {"a",""} // Here I specify {}] // ? When is the value for 'a' treated as null ?
Phoenix
1

votes
3

answer
1.6k

Views

C# Json.Net - How to deserialize complex object Google Elevation

I have this JSON: { "results" : [ { "elevation" : 25.51896667480469, "location" : { "lat" : -26.90408425509977, "lng" : -49.04650926589966 }, "resolution" : 152.7032318115234 } ], "status" : "OK" } This class: public class RootObject { public Elevacao[] results { get; set; } public string status { g...
Tiedt Tech
1

votes
1

answer
1.6k

Views

JSON.stringify() - Escaping Issue

I am currently using AJAX with JQuery to send json to an API server. However, there seems to be an issue with a server that is escaping the JSON string when I use JSON.stringify() but on another server when using the exact same code it works without any problems. Here is an example of the Javascrip...
Daniel West
-1

votes
1

answer
44

Views

Parse JSON result with Attributes

Inside a decoded JSON I have also a sub list with: "steps": [{ "id": 54785, "response": { "attributes": { "xsi:type”:”text1”},”message": { "attributes": { "xsi:type": "xsd:string" }, "$value": "alterMultipleParameter" }, "nextcase": { "attributes": { "xsi:type": "xsd:int" }, "$value": 4823 }...
Ingo
-2

votes
0

answer
27

Views

Reading Json file in python

I am new to python and I am trying to read my json file (from local) in python. But the output that i print is looking like this: C:\Python27\python.exe C:/Users/lehmdir/.PyCharmCE2018.3/config/scratches/one.py {u'color': u'Red', u'fruit': u'Apple', u'size': u'Large'} Process finished with exit code...
Aju Antony
0

votes
0

answer
3

Views

Displaying JSON data in a 'Zotero'-like fashion, using Tkinter

So I have data in the form of JSON files as per the following: json = { "moments": [ { "N1": { "scheme": "NH3_ISA-GRID", "type": "N", "rank": "4", "moments": [ " Q0 Q1 Q2 Q3 Q4", "0 -1.064525 -0.000004 0.340138 0.000004 0.047612", "1s NaN -0.105246 -0.0...
Gianluca Cientanni
0

votes
0

answer
4

Views

Coco dataset to voc dataset for darkflow

I am working on a project of object recognition in darkflow andI want to train it with the coco dataset. Darkflow can only work with the voc dataset so far I know. So I am trying to convert the coco dataset json to multiple xml files darkflow need. I want to create a script in vb.net because I know...
Woebenskie
-4

votes
2

answer
80

Views

AttributeError: 'unicode' object has no attribute XXX

I'm trying to use pipl. I want to get the info from a mail and save it into a Excel file. from piplapis.search import SearchAPIRequest from piplapis.search import SearchAPIError from openpyxl import load_workbook request = SearchAPIRequest(email=u'[email protected]', api_key='......') try: resp...
SoftTimur
1

votes
2

answer
20.2k

Views

How to get the attribute of JSON object in javascript containing the '#' in the key [duplicate]

This question already has an answer here: How to access object properties containing special characters? 1 answer I have the JSON object returned by the api of last.fm as follow: { "artists": { "artist": { "name": "Daft Punk", "playcount": "494599", "listeners": "106101", "mbid": "056e4f3e-d505-4da...
zambliner
1

votes
2

answer
1.8k

Views

JS data in localStorage only being kept in one key, value pair

I am trying to write a simple app in an attempt to learn about HTML5's localStorage. I (thought I) had successfully created a form to take data and store it in localStorage (with JSON.stringify) and then display it on the page (after JSON.parse). I then moved on to how to delete specific items and r...
tehaaron
1

votes
1

answer
2.2k

Views

Django QuerySet not serializable

I have the following function I'm using to make Ajax calls: 30 import json 31 32 def get_info(request): 33 run = Run.objects.values('nvp_build', 'lports', 'lswitch_stt') 34 measurements = Measurements.objects.values('maxfield') 35 apistats = APIStats.objects.values('num') 36 clusterdata...
cybertextron
1

votes
2

answer
1.9k

Views

Dynamic property filter using Jackson 2

I am building a REST service platform in which we have to support following query pattern: format=summary which means we have to deserialize only the POJO attributes annotated with our custom annotation @Summary format=detail which means we have to deserialize only the POJO attributes annotated with...
Niranjan
1

votes
1

answer
2.9k

Views

Get Android Volley response in another class

I'm trying to use Volley as a DBA layer to call a webservice that hadles JSON objects. Because this layer is below the activity and another service layer, it doesn't seem to be working properly. I'll try to explain my setup: MainActivity: protected void onCreate(Bundle savedInstanceState) { super.on...
Zorrocaesar
1

votes
1

answer
2.5k

Views

Can Jersey convert a GET returned POJO to XML or JSON depending on the request's Accept header?

This question is for Jersey 2.x. Let's say I have a GET method. The client request contains an Accept header for either XML or JSON. Is it possible for the method to return a POJO in the representation the client requested? Currently, my GET method returns JSON using Jackson. But I don't know how...
devdanke
1

votes
2

answer
61

Views

Building nested arrays in PHP

So I'm trying to build a JSON object with an array nested inside the main users array. I'm having a bit of trouble building the data model in the PHP. Can anyone give any pointers? Desired output: [{ id: 2, name: "John Wilson", profilePic: "fighter-1.jpg", activities: [{ id: 6431, time: (57).minut...
user2656127
1

votes
1

answer
1.3k

Views

Fetch column name and rows data from mysql and create json

Here I have an database mysql: I need to make a json file in this format: {"cols":[{"label":"ID","type":"number"},{"label":"Naziv","type":"string"},{"label":"Povrsina","type":"number"},{"label":"Lokacija","type":"string"},{"label":"Arkod ID","type":"number"},{"label":"Osnov koriscenja","type":"strin...
gmaestro
1

votes
1

answer
326

Views

Django + rest-framework: serialize arbitrary query

I have three classes representing different sections in my models: SectionA, SectionB, SectionC. Each of these sections have associated a set of items (class Item in my model). I would like to get a json similar to this: { "sectionA": [ { "id": 1, "picture": "car_pic1", "category": "cat1" }, { "...
Esparver
1

votes
1

answer
657

Views

Node.js fs.readFile vs jQuery $.getJSON - which is faster?

I'm working on a program running in Node-Webkit, and I use jQuery for many other tasks. Now I have a settings.json file that I need to load upon the start of the program, and I was thinking about how to load it. So either I use the node.js fs functions to read the data from the file and then use JS...
woubuc
2

votes
4

answer
64

Views

How to save JSON data to a variable in JavaScript

I'm trying to display ping information in a html page that is presented in JSON format. I have some what achived it but i can't figure out how to print it out in an ordered way. JS Script function scanner() { var evilscan = require("evilscan"); var options = { target: "10.0.0.161", port: "21-23", st...
Christophermp
-2

votes
2

answer
23

Views

How to parse Json with multiple array?

I want to parse Json with multiple array. Below is my Json file Json Format : { "data":"{\"categoryArray\":[\"Bandwidth\",\"Class of Service\",\"Core Services\",\"Default CPE\",\"Management Fees\",\"Premium MRC\"],\"categoryValueArray\":[{\"Bandwidth\":{\"Bandwidth\":\"10 Mbps\"}},{\"Class of Se...
jabeen akkalkot
-1

votes
0

answer
18

Views

How to update an property of JObject using extension method in C#?

JObject tempEntityList = JObject.FromObject(tempEntity); this is my JObject and suppose this contains a json like this: {"AgencyConfigId" : "100.1000.1", "Version" : { "VersionNumber" : 1, "IsLatestVersion" : true } } I want to change the the VersionNumber to something else. one way of doing this is...
Raj Kumar
1

votes
2

answer
506

Views

json validation not working?

I am trying to validate my json through schemavalidation but I think there are some issues: string schemaJson = @" { 'description': 'A payload', 'type': 'object', 'properties': { 'totalRecords': {'type':'number'}, 'payload': { 'type': 'object', 'properties': {'name':{'type':'string'}} } }, 'addition...
user603007
1

votes
2

answer
73

Views

jQuery Loop that slows your browser

I'm creating online chat, but I'm wondering while using jQuery .load() in my script, my browser seems to get slow. When i checked the inspect element "Net" section, it loads bunches of GET-data... etc. I would like to know if there's a better script solution with this code to prevent chat being heav...
iMarkDesigns
1

votes
1

answer
920

Views

Django/Tastypie - DELETE requests deleting everything

I have the following model class Open(models.Model): name=models.TextField() opened=models.DateTimeField(auto_now_add=True) user=models.ForeignKey(User) and the following resources class UserResource(ModelResource): class Meta: queryset = User.objects.all() resource_name = 'user' class OpenResource(...
user3264316
1

votes
4

answer
53

Views

Simple PHP rest json duplicates data fields

I'm iOS developer and for finishing prototype I need simple php code which could return data from particular table as JSON. Here is a code I developed: The problem is that it duplicates data fields. Here is a result I receive: [ { "0":"1", "id":"1", "1":"Some title", "title":"Some title" } ] In data...
Sergio
1

votes
1

answer
821

Views

Display nested items in JSON object with jQuery [duplicate]

This question already has an answer here: jQuery JSON looping through nested objects 2 answers I'm trying to display nested items in my JSON object. Right now their value is [object Object]. I'm using a $.each loop but it doesn't seem to be getting the values of the nested items. What am I doing wr...
Aaron Turecki
1

votes
2

answer
1.2k

Views

How do I convert json file into HTML without adding them into an element first?

on jQuery's website there is a documentation says, $.getJSON( "ajax/test.json", function( data ) { var items = []; $.each( data, function( key, val ) { items.push( "" + val + "" ); }); $( "", { "class": "my-new-list", html: items.join( "" ) }).appendTo( "body" ); }); For those who have used this met...
Aero Wang
1

votes
1

answer
671

Views

JSON classes in Qt vs other JSON parsers in C++

I'm developing a server/client application in C++ and im using Qt as my IDE as well as some of its libraries. Performance-wise i was told that one of the best ways to transfer data between a server and client was via JSON. However i would like to know the performance differences between the default...
TheDillo
1

votes
1

answer
657

Views

REST Service | JSON response format

I have created a REST Web Service using RESTEasy implentation of JAX-RS. I have an Employee POJO class which is sent as response. The response is in the json format. The problem is that I am returning the List of Employees back to the caller. Below is the code. Below is the Employee POJO class @XmlA...
Manav Bhanot
1

votes
1

answer
138

Views

Update Sharepoint 2013 using Python3

I am currently trying to update a Sharepoint 2013 list. This is the module that I am using using to accomplish that task. However, when I run the post task I receive the following error: "b'{"error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","val...
0

votes
0

answer
6

Views

c# - Web API send POST request with object

I am new to web api and I can't seem to send an object from the .net project through POST. Here is the code to send the object: public bool CreateUser(User userCreate) { var uri = new Uri(string.Format(apiUrl + "api/Users/", string.Empty)); string jsonUser = JsonConvert.SerializeObject(userCreate);...
aronccs
0

votes
0

answer
3

Views

How do I delete a nested JSON object if one of its keys matches a criteria?

My json looks looks something like this. I am trying to delete the entire json objects if the tag "type" value matches "Date". If it does it deletes the nested object from "id" to "type" altogether. [ { "text": "abcdef", "id": "369-03", "tags": [ { "id": "P0", "start": "16", "end": "26", "text": "...
mojo_28
0

votes
0

answer
6

Views

How to inject dependency into Jackson Custom deserializer

I want to enable a custom jackson deserializer of some fields of type String. The deserializer also needs to be injected with a guice based dependency bean. SampleCode below: public class CustomDeserializer extends StdDeserializer { private SomeDependecy dependency; public StringSifDeserializer() {...
Sashwat
1

votes
1

answer
2.1k

Views

C# JSON.Net parse and get list of all elements matching a value using LINQ

I'm having trouble finding the correct method for getting a list of json arrays from JObject. _name element inside the array should be equal to foo. This is the sample json: { "doc": [{ "bob": [{ "tom": [{ "frank": [{ "category": [{ "_name": "foo", "letters": "abc" }, { "_name": "foo", "letters": "d...
VixinG

View additional questions