@uzelux/json

JSON Object Extension

Usage no npm install needed!

<script type="module">
  import uzeluxJson from 'https://cdn.skypack.dev/@uzelux/json';
</script>

README

JSON Plus

An extension to the build-in JSON object


USAGE

require('@uzelux/json');

Clean

This is to remove all undefined values within the JSON

JSON.clean({a: 'value', b: undefined, c: null, d: '', e: [], f: {}});
// {a: 'value', c: null, d: '', e: [], f: {}}

Purge

This is to remove all empty values (null, empty string, empty array, zero property object)

JSON.clean({a: 'value', b: undefined, c: null, d: '', e: [], f: {}});
// {a: 'value'}