# pjson

> Reads package.json regardless of it's path, always finds the root one. Returns an object

Latest version **1.0.9** (published 2017-09-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install pjson
pnpm add pjson
yarn add pjson
bun add pjson
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.9 |
| Published | 2017-09-01 |
| First published | 2015-07-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 25 |
| Author | Serkan Yersen |
| Maintainers | serkanyersen |
| Keywords | package.json, version, package, info, typescript, utility |

## Links

- npm: https://www.npmjs.com/package/pjson
- Repository: https://github.com/serkanyersen/pjson
- Homepage: https://github.com/serkanyersen/pjson#readme
- Issues: https://github.com/serkanyersen/pjson/issues
- npm.io page: https://npm.io/package/pjson

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.9 (latest) — 2017-09-01
- 1.0.8 — 2017-03-06
- 1.0.7 — 2015-10-04
- 1.0.6 — 2015-10-04
- 1.0.5 — 2015-10-04
- 1.0.4 — 2015-07-06
- 1.0.3 — 2015-07-06
- 1.0.2 — 2015-07-06
- 1.0.1 — 2015-07-06
- 1.0.0 — 2015-07-06

## README

# PJSON

PJSON is a simple npm package that let's you read the package.json file.

## Usage

Install it
```
npm install pjson --save
```

and use it in your code like this

```javascript
var pjson = require('pjson');

// simply access values package.json
console.log(pjson.version);
```

## Why?

In Node.js you can already import json files by simple giving their names in the `require` statements but this approach doesn't always work well.  

First of all it's path dependend. So if your project has a nested structure you might endup with a code that looks like this

```javascript
var pjson = require('../../../package.json');
```

#### TypeScript

In typescript you cannot create module definitions for relatively imported things. PJSON resolves this issue for you because you can import it just by name

#### Old versions of Node

Importing JSON files using require is only enabled on late versions of node. For old versions, PJSON is might be useful

#### Because I need it

It's simple, I needed it for my own project and I though it might be useful for other as well :)

---
_Source: https://npm.io/package/pjson · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
