Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

75
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!