{"_id":"@boursorama/typed-json","_rev":"2-cf304d7393405a300aaf1e5816aa5780","name":"@boursorama/typed-json","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@boursorama/typed-json","version":"1.0.0","description":"A safe and elegant way to deal with Json data inspired by SwiftyJSON","main":"index.js","repository":{"type":"git","url":"git+ssh://git@github.com/boursorama/TypedJSON.git"},"author":{"name":"Benoit Giannangeli","email":"benoit.giannangeli@boursorama.fr"},"license":"MIT","private":false,"devDependencies":{"@tsconfig/recommended":"^1.0.1","@types/jest":"^27.4.0","jest":"^27.5.1","ts-jest":"^27.1.3","ts-node":"^10.5.0","typescript":"^4.5.5"},"scripts":{"test":"jest"},"gitHead":"fb5275ee34736a17221b7f1685986c4d175c9610","bugs":{"url":"https://github.com/boursorama/TypedJSON/issues"},"homepage":"https://github.com/boursorama/TypedJSON#readme","_id":"@boursorama/typed-json@1.0.0","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"integrity":"sha512-8IIRE7eaavXAtQvAmRG5hww7WcAetef+AX4lDrYtCtMj/oRZjMhf673YcKysIMCs3UfUdlZuErlTwC2bzaWL/Q==","shasum":"2fd0a2618f71817dc56a912e45d3c6f9bba3df53","tarball":"https://registry.npmjs.org/@boursorama/typed-json/-/typed-json-1.0.0.tgz","fileCount":7,"unpackedSize":11460,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiFfGUACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrxPxAAoqHWMWPHSzSG+S3LRvFkD/T59yI/zpqTETQwfiaHHvpaz6b7\r\nins3MuhP47AHMfuiaifRIaK8FzsaNQWIzUzNeLS2z5XO+XhwFAG86R8B0hnN\r\nerspLqGL6xDswiOnISa/mD/N4w8MYKc2MigeVJQ+5aMVMxDoAy0M19LKTHee\r\n+R859O2kVU6TGixtsxxUAPoep9z6kUMPQ6977k2zHI2dFjY2avh5bL2aJqSx\r\n7+vx0/vKGi96bEii5+tf4s/1lM0I3dWxsWrcW7kYbQ/4DvcqtFCJb64g1XfB\r\n0DVq3x4tUB+JocpwrVctEhDwJypQXLlzDINlCNGCiuWA7e/luKpam8uF9cvm\r\npWyKIIIfS6UHA+gb3vsuh3JAVmLKibNKNnN+/tnuJ9mikyqsklRuhfXaZOO2\r\n5L/sfPbHDVbHZ9N/kwccb3sA8pfj44ftK6981QQv6YYY33PFWrH4LVXuGQRr\r\n/J3IdhJ4tG1MSac96VVMyN28sBigXYdug/mx/JcD8KqOVYeAK6nAWjhXrUCH\r\nZ3+YpU25Crxn48b8fUa0D7nRHpgkjdfrJoZGIn3O6Frsac+FEab+MhoZbPto\r\nmCRyEpfv5j7foEbbWzYNahnXZc2Db4A79yEhebLPxAeWO7LsSpsfd87hMM6y\r\n3Sa01A6n0fn4TrthBuYtgvjCI88bpomiJcI=\r\n=6tw/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBO1PfV61/iKLLotdY887ej4QX30oLaNnm4aZ56qDqVmAiEAuHPUdwVt4yoLfhrVBBwNYn8wFofp1PB6MfLiu4FeXI8="}]},"_npmUser":{"name":"bgiannan","email":"benoit.giannangeli@boursorama.fr"},"directories":{},"maintainers":[{"name":"bgiannan","email":"benoit.giannangeli@boursorama.fr"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typed-json_1.0.0_1645605267844_0.7207960896685914"},"_hasShrinkwrap":false},"1.0.1":{"name":"@boursorama/typed-json","version":"1.0.1","description":"A safe and elegant way to deal with Json data inspired by SwiftyJSON","main":"src/index.js","repository":{"type":"git","url":"git+ssh://git@github.com/boursorama/TypedJSON.git"},"author":{"name":"Benoit Giannangeli","email":"benoit.giannangeli@boursorama.fr"},"license":"MIT","private":false,"devDependencies":{"@tsconfig/recommended":"^1.0.1","@types/jest":"^27.4.0","@typescript-eslint/eslint-plugin":"^5.12.1","@typescript-eslint/parser":"^5.12.1","eslint":"^7.32.0","jest":"^27.5.1","ts-jest":"^27.1.3","ts-node":"^10.5.0","typescript":"^4.5.5"},"scripts":{"test":"jest"},"gitHead":"47f6eaec528a4a1b443b51fbef97cabaf24ddbbe","bugs":{"url":"https://github.com/boursorama/TypedJSON/issues"},"homepage":"https://github.com/boursorama/TypedJSON#readme","_id":"@boursorama/typed-json@1.0.1","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"integrity":"sha512-MBu307Oy2LmL4+LGq1hobIQkKiIdbdbozUJfw+qBaEsVOiZFcLZZ5w+zKuMXO9x53QlRHahU5MtRv0pAjs3j6Q==","shasum":"4e83766b5e2d701f71d458578bed1c15768aed7e","tarball":"https://registry.npmjs.org/@boursorama/typed-json/-/typed-json-1.0.1.tgz","fileCount":8,"unpackedSize":12040,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiFg5xACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr6Mw//dPWE0sWfyHyqfqgzMBhCFn2v6/o24XfKsZPI2f5CB0XdRLLA\r\noT2g/A6pyjjxOv5IFcUgCtA0dlADEaSICwTeEZKFXOLO26UI7L4K2Ju63udX\r\n1NrGTWZ/7Tw5Tn94ythKEa/hfgFm4dBMUyMvthKWSmu/mt3hfin2ubS3FNyw\r\nwUyUYiqqeWY3OXdKKcdA71itFe/YuayVRRUjCI5STeBOyDHHXf2dKVbP4LAK\r\n3mwLArEo68ADtmjbfo/Dr0YJ/XTpYJBetEdvpUuaryU3G78/+ghlRzsk8LiA\r\n47Z6trtw2RQle1Zf5RJbxfKPCTYReJ7vgk9+2vJpciP/mJebI5wkfQdg3bF1\r\nixr1i5vJgVKssbZfEzo/ayK4iIAWl2ewqIf0JnE0Gkt22jwln0aGxDWbU0ie\r\nDIL09rGukmjSAQbUTgjL8XhrAjrdZSyHbZf9ugPHxRI7t4s8AcFTrsdAWtoa\r\nG+BNZ08yfMWWNpc4yedv8f1CgCBcvcsedNyn9nCKFtDbo1hSyd2Nu/XmhKii\r\nC0fFzwLLPjF309VvsH8vezMVK1L8mJ3c/ybNv4MVgVR2oLHCycGVAC+I53WB\r\nuhdMPEhWOnYvYQkUV+s4pkfa+dOy9ZBNR3EySGMc/Y7ubzWq1I2ZrXKey0wl\r\nZWH6H2dqr0XzTwKIZMo0FiUKvOif3JcGKQ4=\r\n=PudZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD7/YJsjhSvQX0PkQRuQf5qY7RApphj+jCsprmHXcXRrwIgDeHIYQTzWe4Hk5nhmVQLsDXBHkkfJVvwQ2jf5693YNo="}]},"_npmUser":{"name":"bgiannan","email":"benoit.giannangeli@boursorama.fr"},"directories":{},"maintainers":[{"name":"bgiannan","email":"benoit.giannangeli@boursorama.fr"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typed-json_1.0.1_1645612656854_0.3892784515118284"},"_hasShrinkwrap":false}},"time":{"created":"2022-02-23T08:34:27.789Z","1.0.0":"2022-02-23T08:34:28.042Z","modified":"2022-04-04T20:16:10.888Z","1.0.1":"2022-02-23T10:37:37.000Z"},"maintainers":[{"name":"bgiannan","email":"benoit.giannangeli@boursorama.fr"}],"description":"A safe and elegant way to deal with Json data inspired by SwiftyJSON","homepage":"https://github.com/boursorama/TypedJSON#readme","repository":{"type":"git","url":"git+ssh://git@github.com/boursorama/TypedJSON.git"},"author":{"name":"Benoit Giannangeli","email":"benoit.giannangeli@boursorama.fr"},"bugs":{"url":"https://github.com/boursorama/TypedJSON/issues"},"license":"MIT","readme":"# TypedJSON\n\n[![npm](https://img.shields.io/npm/v/@boursorama/typed-json.svg)](https://npmjs.com/package/@boursorama/typed-json)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n🚚 A safe and elegant way to deal with Json data in TypeScript inspired by [SwiftyJSON](https://github.com/SwiftyJSON/SwiftyJSON)\n\n## What is it?\n\nSafely interact with Json data by requiring the user to specify what type of data they want to extract.\n\n```typescript\nlet json = Json.fromString(jsonString)\n\n// Gets the data under `someKey`, if a string returns it otherwise return undefined\njson.get('someKey').string()\n// Same but provides default empty string if `someKey` does not exists or is not a string\njson.get('someKey').stringValue()\n\n// Same exists for all json types\njson.get('someKey').boolean()\njson.get('someKey').booleanValue() // Will try to coerce the data to bool and returns false if couldn't\njson.get('someKey').float()\njson.get('someKey').floatValue() // Will try to coerce the data to double and returns 0 if couldn't\njson.get('someKey').integer()\njson.get('someKey').integerValue() // Will try to coerce the data to int and returns 0 if couldn't\n\n// List items and Map values are wrapped in Json instances, which enables chaining acces to them\njson.get('alist').array()\njson.get('amap').object()\n\n// If any path element does not exist or is not subscriptable, it'll return undefined\njson.get(['you', 'can', 'chain', 'them']).string()\n\n// If you want the unaltered data you can get it with `rawValue`\njson.get('some').rawValue\n\n// If you want list and map with unaltered values\njson.get('list').arrayRaw()\njson.get('map').objectRaw()\n\n// If you get undefined, you can check if its the result of an illegal access\nif (json.get('idontexists').exception !== undefined) {\n  console.log('something went wrong')\n}\n```\n","readmeFilename":"README.md"}