Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Query JSON - liteNew to Visual Studio Code? Get it now.
Query JSON - lite

Query JSON - lite

Quang Nhan

|
4,293 installs
| (0) | Free
Query JSON file using XPath like expression
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Query JSON - lite

Interactively query a JSON file using XPath like notation

Features

  • Query JSON object | array
  • Filtering
  • Built in Functions
  • Find Mode (beta)
  • Editor Features

Query JSON object | array

object

  • "/a/b" : get the value of "b" by traversing from root to "a" to "b"
  • "//h" : from root grab any decendants' value with key "h"

array

  • /incomes/* : grab all objects in incomes array
  • /incomes/*/type : return all income types

Query Object And Array JSON


Filtering

  • /incomes/*[ frequency = "monthly" ]: return incomes that have a frequency value of "monthly"

Filter Income Monthly

  • /expenses/*[ value > -400 and value < -200 ]: return expenses where its' value is between -400 and -200

Filter Income Monthly


Built in Functions

Query JSON uses JSXPath behind the scene to perform path querying. Check out the available built-in functions here.

  • count( /expenses/*[ type = "transport"] ): Count how many transport expenses.

  • ceiling( /incomes/*[ last() ]/value ): combines both ceiling and last functions to return the rounded up integer value of the last positioned income

  • sum( /incomes/*[frequency="monthly"]/value ) - abs( sum( /expenses/*[frequency="monthly"]/value ) ): combines both sum and abs functions to get the net income for incomes and expenses that have frequency of "monthly"


Find Mode (*beta release)

Search through workspace folders for the given path expression

  • return files that matches the search term and the entered path expression
  • search term examples
    • search term: file.json - search for all directories for file.json

    • search term: *file*.json - search for all directory for files that contains "file" in their name

    • search term: dir - search for directories or json files that contains "dir" in their name

  • search term is case insensitive
  • supports multi search terms separate by commas
    • search term: file1.json,file2.json - search for all directories for file1.json and file2.json files


Editor Features

  • Result to new file: once the result is returned in the Query Result view, view the whole result in a new file by clicking on the Output button displayed next to the Query Result title.
  • Path History: each run will save the path (max 20) to be reused and important ones can be starred (max 5)
  • Dynamic Highlight: highlight the result in the queried document with selectable/adjustable color
  • Jump to line: click on any child of the Query Result to jump to the matching text in the editor
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft