Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

76
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda