How would I parse multiple or more objects via jQuery?

Tags: , ,

like so

► add language identifier to highlight code

def function(foo):

► put returns between paragraphs

► for linebreak add 2 spaces at end

italic or bold

► indent code by 4 spaces

► backtick escapes like _so_

► quote by placing > at start of line

► to make links (use https whenever possible) example example


As mentioned by @Pointy there are multiple syntax errors in your code (when accessing the obj array).

But the reason it wouldn’t work even after you fix these syntax errors is that the result of your API call is a string and you need to parse it using JSON.parse().

$.get('', function(obj) {
  // Parse the received json
  const result = JSON.parse(obj);
  // Fix the syntax errors
  document.writeln(result[0].FFN + " : " + result[0].AvailableBuild);
  // Add a line break
  document.write('<br />')
  // Fix the syntax errors again
  document.writeln(result[1].FFN + " : " + result[1].AvailableBuild);
<script src=""></script>

Also consider using Fetch API is your targeted browsers support it.

const appendItem = item => document.body.innerHTML += `<p>${item.FFN} : ${item.AvailableBuild}</p>`;

fetch('').then(response => {
  response.json().then(result => {

Source: stackoverflow