-1

I'm trying to do a for in in an obj Json array looking for a variable, specify the following example. Thank you very much in advance. I want to consult which division a certain team is in "Vasco". I wanted to understand what better way.

{"table":{"1° Division":["Flamengo","Goiás","Palmeiras"], "2° Division": ["Real","Barc","Madri"], "3°Division": ["Vasco","Itunbi","Recife"]}}

Gustavo
  • 7
  • 1
  • It’s `Object.keys(yourObject.table).find((key) => yourObject.table[key].includes("Vasco"))`. Get familiar with [how to access and process objects, arrays, or JSON](/q/11922383/4642212), how to [access properties](//developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Property_Accessors), and use the static and instance methods of [`Object`](//developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object#Static_methods) and [`Array`](//developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array#Static_methods). – Sebastian Simon Jan 22 '23 at 15:09

1 Answers1

-1

if you treat the json as an array it should come easy for you. after that you can use a shorting algorithm

Iach
  • 1
  • 1