{"id":47691,"library":"firestore-parser","title":"firestore-parser","description":"Library to parse Firestore REST API JSON responses into plain JavaScript objects. v0.9.0 (latest) - stable, maintenance mode. Transforms Firestore's verbose type-keyed format (e.g., {stringValue: \"foo\"}) into natural JS types (e.g., \"foo\"). Unlike manual mapping or generic JSON manipulation, this library handles all Firestore value types recursively, including nested maps, arrays, timestamps, and references. Ideal for developers working directly with Firestore's REST API (not client SDK) who need clean output.","status":"maintenance","version":"0.9.0","language":"javascript","source_language":"en","source_url":"https://github.com/jdbence/firestore-parser","tags":["javascript","JSON","Firebase","Firestore","Rest"],"install":[{"cmd":"npm install firestore-parser","lang":"bash","label":"npm"},{"cmd":"yarn add firestore-parser","lang":"bash","label":"yarn"},{"cmd":"pnpm add firestore-parser","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Library ships ESM only (no CJS export). Use import, not require. Also, note case-sensitive: FireStoreParser (capital F, S, P).","wrong":"const FireStoreParser = require('firestore-parser')","symbol":"FireStoreParser","correct":"import FireStoreParser from 'firestore-parser'"}],"quickstart":{"code":"import FireStoreParser from 'firestore-parser';\n\n// sample Firestore REST API response\nconst firestoreResponse = {\n  name: 'projects/my-project/databases/(default)/documents/players/steve',\n  fields: {\n    name: { stringValue: 'steve' },\n    health: { integerValue: '100' },\n    alive: { booleanValue: true },\n    position: { mapValue: { fields: { x: { doubleValue: 10.5 }, y: { doubleValue: 20.3 } } } },\n    inventory: { arrayValue: { values: [{ stringValue: 'sword' }, { stringValue: 'shield' }] } },\n    createdAt: { timestampValue: '2023-01-15T12:00:00Z' },\n    ref: { referenceValue: 'projects/my-project/databases/(default)/documents/items/123' }\n  }\n};\n\nconst parsed = FireStoreParser(firestoreResponse);\nconsole.log(parsed);\n// => {\n//   name: 'steve',\n//   health: 100,\n//   alive: true,\n//   position: { x: 10.5, y: 20.3 },\n//   inventory: ['sword', 'shield'],\n//   createdAt: '2023-01-15T12:00:00Z',\n//   ref: 'projects/my-project/databases/(default)/documents/items/123'\n// }","lang":"javascript","description":"Parses a Firestore REST API response (with stringValue, integerValue, etc.) into a plain JS object with native types."},"warnings":[{"fix":"Use import FireStoreParser from 'firestore-parser' or dynamic import(). For CommonJS projects, use async import or downgrade to v0.7.1.","message":"E Only: This package is ESM-only since v0.8.0. Using require() will throw a runtime error.","severity":"gotcha","affected_versions":">=0.8.0"},{"fix":"Create a .d.ts file: declare module 'firestore-parser' { export default function FireStoreParser(json: any): any; }","message":"No type definitions: The package does not ship TypeScript declarations. You will get implicit 'any' or need to write your own types.","severity":"gotcha","affected_versions":"*"},{"fix":"Only pass the JSON from firestore.googleapis.com REST API response (e.g., the result of fetch(url).then(r => r.json())).","message":"Input must be Firestore REST response object, not DocumentSnapshot or client SDK object. Passing a Firestore client SDK DocumentSnapshot will produce unexpected results.","severity":"gotcha","affected_versions":"*"},{"fix":"Manually convert: new Date(parsed.createdAt) if needed.","message":"Timestamp values are returned as strings (ISO 8601), not Date objects. This may be surprising if you expected native Date.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'api':9,69 'array':56 'clean':75 'client':71 'develop':62 'direct':64 'e.g':29,36 'firebas':79 'firestor':2,7,22,49,66,80 'firestore-pars':1 'foo':31,37 'format':28 'generic':42 'handl':47 'ideal':60 'includ':53 'javascript':14,77 'js':34 'json':10,43,78 'key':27 'latest':17 'librari':4,46 'mainten':19 'manipul':44 'manual':39 'map':40,55 'mode':20 'natur':33 'need':74 'nest':54 'object':15 'output':76 'pars':6 'parser':3 'plain':13 'recurs':52 'refer':59 'respons':11 'rest':8,68,81 'sdk':72 'stabl':18 'stringvalu':30 'timestamp':57 'transform':21 'type':26,35,51 'type-key':25 'unlik':38 'v0.9.0':16 'valu':50 'verbos':24 'work':63","created_at":"2026-06-07T16:52:48.834029+00:00","updated_at":"2026-06-07T16:52:48.834029+00:00","problems":[{"fix":"Use import FireStoreParser from 'firestore-parser' in an ESM context, or use dynamic import: const { default: FireStoreParser } = await import('firestore-parser').","cause":"Using require() on an ESM-only package with a default export. The require() returns the module namespace object, not the default export.","error":"const FireStoreParser = require('firestore-parser');\n^ TypeError: FireStoreParser is not a function"},{"fix":"Define an interface for the Firestore response or use the library's return type (it returns any). Prefer not to manually access fields; instead pass the whole response to FireStoreParser.","cause":"TypeScript cannot infer the shape of the Firestore response object, leading to type errors when accessing fields manually.","error":"Property 'stringValue' does not exist on type 'Object'."},{"fix":"Install @types/firestore-parser? (none exists). Instead, declare module manually as described in warnings. Alternatively, use // @ts-ignore.","cause":"The package has no bundled TypeScript declaration files, so TypeScript projects may fail to resolve types.","error":"Cannot find module 'firestore-parser' or its corresponding type declarations."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/jdbence/firestore-parser#readme","github":"https://github.com/jdbence/firestore-parser","docs":null,"changelog":null,"pypi":null,"npm":"firestore-parser","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}