Questions tagged json

Explore the latest questions and answers asked by our top developers.

Using HttpClient to make get requests

I have written the following code to get the dummy data here: export class AppComponent { jsonPosts: any = []; constructor(private httpClient: HttpClient) { } OnInit() { this.getJsonPosts(); } getJsonPosts(): any { return this.httpClient.get("https://jsonplaceholder.typicode.com/posts") .subscribe(response => { console.log(response); this.jsonPosts = response; }); } I have also written the following code to display them in my […]

By CatarinaRuna
Published
Categorized as angular, html, http, json, typescript Tagged , , , ,

Angular: Observable with subscribe returns error 200 OK as the response is not JSON

I am developing a front-end web application using Angular 11. This application uses several services which return data in JSON format. I use the async / await javascript constructs and the Observables to get the answers from these services. This is an example my call: let myResponse = await this.myService(this.myData); myResponse.subscribe( res => { console.log("Res: […]

How to map a JSON object to a TypeScript class?

I have a JSON received from b-end and I don’y know how to map it in Angular project via a TypeScript class. I want those data coming from JSON to be received in Agular class so I can render to front end. JSON: { "_embedded" : { "sysQuestions" : [ { "difficulty" : "M", "question" […]

By byte is 8bits
Published
Categorized as angular, javascript, json, typescript Tagged , , ,

Saving the file-input of locally saved files to JSON and acessing them later

I would like the users of an Angular-Application to be able to select multiple locally saved files (from their hard drive for example) and view them in the app. They can save their progress and settings to a JSON file and import this JSON file the next time they open the app in order so […]

By GyroGoober
Published
Categorized as angular, file-io, html, javascript, json Tagged , , , ,

Angular-Springboot Can’t map my File property to my MultipartFile property

I was following a tutorial where a dude sent a File to sbringboot and it got mapped correctly to a MultipartFile type like so: @PostMapping("/upload") public BodyBuilder uplaodImage(@RequestParam("imageFile") MultipartFile file) But I needed to modify the code to make the file a property, so I put it in my class public class FullAnnuncio { private […]

By santocielo99
Published
Categorized as angular, java, json, spring-boot, typescript Tagged , , , ,

How to create TypeScript class from Json data?

I’m using Angular to call an external API. Json data is in format like: [ { "AccessGroupsIdList": [], "FirstName": "Greg", "LastName": "Tipton", "LocationIdList": [], "PermissionProfile": { "Name": "Agent", "PermissionProfileId": { "ID": "xy678219-bd7c-103d-b56b-1f1234a85990" }, "Type": 3 }, "ManagerName": "Gilchrist, George", "Status": true, "UserGroupID": { "ID": "00000000-0000-0000-0000-000000000000" }, "UserGroupName": "ROOT", "UserId": { "ID": "4445cc66-819a-4da0-8fbf-d0bb8ce65941" } } ] […]

By SilverFish
Published
Categorized as angular, json, typescript Tagged , ,

Set value of multidimensional json object

I have created a model class with name registration.ts export class CustomerRegistration{ customer: [{ firstname : string; lastname : string; email: string; }] password: string; } Then I have created a component and in that component I am trying to set value in above class import { Component, OnInit } from ‘@angular/core’; import { CustomerRegistration} […]

By Karan Adhikari
Published
Categorized as angular, angularjs, json Tagged , ,

Set value of multidimensional object

I have created a model class with name registration.ts export class CustomerRegistration{ customer: { firstname : string; lastname : string; email: string; } password: string; } Then I have created a component and, in that component, I am trying to set value in above class import { Component, OnInit } from ‘@angular/core’; import { CustomerRegistration} […]

By Karan Adhikari
Published
Categorized as angularjs, json Tagged ,

Group a list of objects in nested arrays javascript

I have an array of objects as below [ { id: 10, regionName: "Europa", countryName: "Greece", applicationName: "Ramco", issueSummary: "No Reported Issues", resolutionEta: "", status: "UP" }, { id: 9, regionName: "Asia PAC", countryName: "Singapore", applicationName: "Reckon", issueSummary: "No Reported Issues", resolutionEta: "", status: "UP" }, { id: 7, regionName: "Asia PAC", countryName: "Thailand", applicationName: […]

By user2004
Published
Categorized as angular, javascript, json Tagged , ,

Angular: Map the httpClient Json list response to Typescript Class

I am trying to map the Json response to a Typescript class in Angular. Json Response: [{"id":1,"nodeName":"Root","parentNodeId":null,"value":100.0,"children":[]}] Although when I run locally I don’t see error but the list is still undefined when I try to print on stackblitz, I see below error: error: SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse […]

By Gaurav
Published
Categorized as angular, angular-httpclient, json, typescript Tagged , , ,
1 70

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq