I am pretty new to vb.net and to json I am using newtonsoft to parse my json responses but am struggling with this json
https://dvlasearch.appspot.com/MotHistory?licencePlate=mt09nks&apikey=DvlaSearchDemoAccount
I can load the main parts date, mileage etc into listview OK But I want to be able to click on a row and the load the advisory's and failures (if any) into listboxes to be viewed.
Thanks in advance.
Related
I am new to reading Json data and populating the form. I have spent few days on this and still cannot figure out.
HTML data
Jason data object response
I am trying to populate the form field jobDescId, EducationId from JSON response.
To start with, I am trying to use Jquery to find the form field that I am looking
$(".BasicInfo.Education0.EducationId") and this is not working..I get the following when I run this Chrome dev tool tab.
w.fn.init [prevObject: w.fn.init(1)]length: 0prevObject: w.fn.init [document][[Prototype]]: Object(0)
I am not sure how to loop the data as I have two item for education list.
I’m a novice and am struggling to work out how to use the Newtonsoft JSON methods to pull out of this JSON string what I’m after with VB.Net.
The first thing to note is that the JSON is in two parts, the Total and then the results.
"{""total"":9,""results"":[{""id"":1334,""description"":""Fiat"",""type"":0},{""id"":1331,""description"":""Ford"",""type"":0},{""id"":1330,""description"":""Nissan"",""type"":0},{""id"":1335,""description"":""Project
Alpha"",""type"":0},{""id"":1336,""description"":""Project
Beta"",""type"":0},{""id"":1337,""description"":""Project
Gamma"",""type"":0},{""id"":1333,""description"":""Tesla"",""type"":0},{""id"":1332,""description"":""Toyota"",""type"":0},{""id"":1329,""description"":""Volkswagen"",""type"":0}]}"
What I want to do is search the JSON for a particular description and get back the ID. For example if I searched for “Toyota” I would get back “1332”.
I have looked at the examples on this and other forums but failed to get any to work for me.
BTW I note that I could loop through the children in the ‘results’ but looping seems inefficient so I’m hoping to use a more efficient method.
First create an Object representing your Json (copy your json to clipboard, in Visual Studio create an empty class and paste it as json classes Edit -> Paste Spacial -> paste json as class - I have a german VS, so maybe the menu is named differently)
Deserialize the json string in a new instance of this class
do your filtering as you need
I made a sample app for you on GitHub
I am a beginner in angular. My question is - Based on the excel file which user uploads, api returns some data in JSON format. So the column headers and data are dynamic. I want to display the json data in HTML table.
I want to know how should my json look like and its respective TS and HTML code.
User upload an excel file like this
file example
My output should look like this :
output
First column and row is dynamic.
As you are new to Angular, I will show you one of the procedure you can use
Angular part:
Every time the server sends data, you can get your data by HTTP methods or web-socket by "service" from angular.
Service:
in services, you can import HTTP to get data and after you get data you can emit it by using "behavior-subject" to any component you want which contains your tables and save data values there. (behavior-subject is from rxjs library).
Component:
Now your component in angular has the json data every time and you can analyze
your JSON file, based on your JSON shape you can use *ngfor in the HTML part of the component table and it will change the table online.
I am currently building a web app with ember.js and webapi 3.
Currently I am facing the problem that webapi sends a JSON result (of an array of DTOs) which doesn't get understood by ember because it is missing a root element.
I didn't got far with the solutions on the web, which mostly just pointed to a template project for VS.
Has someone a simple and understandable solution?
I'm going to assume you're talking about Ember-Data.
web-api sends back json in whatever format the object is, so if you're sending back a list/array it's going to return an array of objects. If you have control of the controller then just modify what it's returning.
return new { foos = new List<string>() };
I basically have the following flow:
XML -> JSON -> Spring MVC -> jsp page, which is displayed as a table with editable fields.
How do make is so that when i edit a field value it correct updates the Json Object?
I have used some nasty hacking at the moment, as i know (testing) the values/object I am going to get, so im just parsing the JSON string in javascript and sending that back.
So i can then just convert the json object (with new values) and post it back.
Cheers.
You could use the serialize method from prototypejs.
http://www.prototypejs.org/api/form/serialize
just by calling .serialize() you'll be able to get the updated object.