Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

77
Vistas
Filtering JSON API results minimally

Im attemtpting to filter results from an API query and was wondering what the best case scenario would be to accomplish this goal.

https://public-api.solscan.io/account/METAmTMXwdb8gYzyCPfXXFmZZw4rUsXX58PNsDg7zjL

Results in:

{"lamports":291171461600,"ownerProgram":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA","type":"token_account","rentEpoch":283,"account":"METAmTMXwdb8gYzyCPfXXFmZZw4rUsXX58PNsDg7zjL","tokenInfo":{"name":"Solice","symbol":"SLC","price":1.28,"volume":1253400,"decimals":6,"tokenAuthority":null,"supply":"400000000000000","type":"token_address"}}

However the intended goal is to only have the value of "supply" show, which in this case would be 400000000000000.

Would need to be as minimal of a solution as possible while being able to be machine read.

My first thought was filter it with JS but that is reliant on processing the JS.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Aside from parsing the JSON into an object, and then extracting the field, you can use a regex and speed it up a bit.

const rx = /"supply":"([^"]*)"/
const m = rx.exec(unparsedJson)
const result = m ? m[1] : undefined

https://regex101.com/r/Vx3Cp6/1

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda