Work with an array of JSON records.

JSON Arrays

json_arrays.js
const minimum = 2;
const text = "[{\"name\":\"red\",\"qty\":1},{\"name\":\"blue\",\"qty\":4},{\"name\":\"green\",\"qty\":6}]";
const firstName = JSON.parse(text)[0].name;
const kept = JSON.parse(text)
  .filter((item) => item.qty >= minimum)
  .map((item) => item.name)
  .join(",");

console.log("minimum=" + minimum);
console.log("first=" + firstName);
console.log("kept=" + kept);
json-arrays JSON arrays often hold records with the same fields. Parse the text, then use array methods to select the records you need.