synopkg
Version:
Consistent dependency versions in large JavaScript Monorepos
80 lines (52 loc) • 2.17 kB
text/mdx
---
title: json
sidebar:
badge: New
---
import { Badge } from "@astrojs/starlight/components";
import ConfigOption from "@partials/option/config.mdx";
import DependenciesOption from "@partials/option/dependencies.mdx";
import DependencyTypesOption from "@partials/option/dependency-types.mdx";
import HelpOption from "@partials/option/help.mdx";
import LogLevelsOption from "@partials/option/log-levels.mdx";
import NoAnsiOption from "@partials/option/no-ansi.mdx";
import SortOption from "@partials/option/sort.mdx";
import SourceOption from "@partials/option/source.mdx";
import SpecifierTypesOption from "@partials/option/specifier-types.mdx";
import QuoteFilters from "@partials/tips/quote-filters.mdx";
Output the state of every instance of every dependency as a JSON object, one per line. This command is best used with tools like [`jq`](https://jqlang.org/) for filtering and processing.
## TypeScript
Each instance printed by `synopkg json` has the type [`JsonOutput`](https://github.com/Synopkg/synopkg/blob/main/npm/synopkg.ts).
## Examples
```bash
# Output all dependencies as JSON
synopkg json
# Output only AWS SDK dependencies
synopkg json --dependencies '@aws-sdk/**'
# Count dependencies by type
synopkg json | jq -r '.dependencyType' | sort | uniq -c
# See more examples
synopkg json --help
# See a short summary of options
synopkg json -h
```
## Options
<QuoteFilters />
### --config <Badge text="<file-path>" />
<ConfigOption command="json" />
### --dependencies <Badge text="<dependency-name-pattern>" />
<DependenciesOption command="json" />
### --dependency-types <Badge text="<comma-separated-dependency-type-names>" />
<DependencyTypesOption command="json" />
### --log-levels <Badge text="<comma-separated-log-level-names>" />
<LogLevelsOption command="json" />
### --no-ansi
<NoAnsiOption command="json" />
### --sort <Badge text="<choice>" />
<SortOption command="json" />
### --source <Badge text="<file-pattern>" />
<SourceOption command="json" />
### --specifier-types <Badge text="<comma-separated-specifier-type-names>" />
<SpecifierTypesOption command="json" />
### --help
<HelpOption command="json" />