{"id":20104706,"url":"https://github.com/binaryb3ast/jsoncraft","last_synced_at":"2026-01-26T01:01:37.076Z","repository":{"id":262431874,"uuid":"887150817","full_name":"binaryb3ast/Jsoncraft","owner":"binaryb3ast","description":"A utility library for simplifying JSON manipulation in JavaScript. Provides methods for deep access, merging, flattening, validation, and more to handle complex JSON data structures with ease.","archived":false,"fork":false,"pushed_at":"2024-11-13T07:32:15.000Z","size":112,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-03T05:01:51.726Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/binaryb3ast.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-12T08:57:16.000Z","updated_at":"2024-11-13T07:32:19.000Z","dependencies_parsed_at":"2025-09-20T23:33:23.624Z","dependency_job_id":"e1ae270d-e366-4e42-b9cd-464171802f2e","html_url":"https://github.com/binaryb3ast/Jsoncraft","commit_stats":null,"previous_names":["binaryb3ast/jsonkit"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/binaryb3ast/Jsoncraft","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binaryb3ast%2FJsoncraft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binaryb3ast%2FJsoncraft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binaryb3ast%2FJsoncraft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binaryb3ast%2FJsoncraft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/binaryb3ast","download_url":"https://codeload.github.com/binaryb3ast/Jsoncraft/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binaryb3ast%2FJsoncraft/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28763082,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T00:37:26.264Z","status":"ssl_error","status_checked_at":"2026-01-26T00:37:25.959Z","response_time":113,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T17:44:28.973Z","updated_at":"2026-01-26T01:01:34.577Z","avatar_url":"https://github.com/binaryb3ast.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JsonCraft 🚀\n\nWelcome to **JsonCraft**, the Swiss Army knife for all things JSON! 🎉 Whether you're wrangling with complex, nested data\nor just need a quick way to merge and update JSON objects, **JsonCraft** has got you covered.\n\nBuilt with simplicity and power in mind, this TypeScript library makes it easy to manipulate JSON structures like a pro.\nSay goodbye to messy code and hello to clean, intuitive methods that make JSON manipulation feel like magic. ✨\n\n🔧 **Features**:\n\n- Effortless merging of JSON objects\n- Safe and easy updates to deeply nested properties\n- Small, fast, and reliable\n\n| Method Name    | Description                                                                        | Link                  |\n  |----------------|------------------------------------------------------------------------------------|-----------------------|\n| `getValue`     | Retrieves a value from a JSON object at a specified path (dot-separated or array). | [Link](#getValue)     |\n| `setValue`     | Sets a value in a JSON object at a specified path.                                 | [Link](#setValue)     |\n| `hasPath`      | Checks if a specified path exists in a JSON object.                                | [Link](#hasPath)      |\n| `deletePath`   | Deletes a property in a JSON object at a specified path.                           | [Link](#deletePath)   |\n| `deepClone`    | Creates a deep copy of a JSON object.                                              | [Link](#deepClone)    |\n| `mergeObjects` | Recursively merges two JSON objects.                                               | [Link](#mergeObjects) |\n| `mapKeyTypes`  | Maps each key in a JSON object to its data type.                                   | [Link](#mapKeyTypes)  |\n| `updateValue`  | Updates the value at a specified path in a JSON object.                            | [Link](#updateValue)  |\n| `renameKey`    | Renames a specified key within a JSON object.                                      | [Link](#renameKey)    |\n| `flatten`      | Flattens a nested JSON object into a single-level object.                          | [Link](#flatten)      |\n| `unflatten`    | Unflattens a previously flattened JSON object.                                     | [Link](#unflatten)    |\n| `isEmpty`      | Checks if an object (or array) is empty.                                           | [Link](#isEmpty)      |\n| `mergeArrays`  | Merges new values into an array at a specified path, ensuring no duplicates.       | [Link](#mergeArrays)  |\n| `pick`         | Picks specific keys from a JSON object.                                            | [Link](#pick)         |\n| `omit`         | Omits specific keys from a JSON object.                                            | [Link](#omit)         |\n| `compact`      | Removes all null and undefined values from an object.                              | [Link](#compact)      |\n| `deepEqual`    | Checks if two objects are deeply equal.                                            | [Link](#deepEqual)    |\n\n### `getValue`\n\nThe `getValue` method is used to retrieve a value from a JSON object at a specified path. The path can be a combination\nof dot-separated keys for nested objects or array indices for arrays. This method allows you to access deeply nested\nvalues in a JSON structure.\n\n#### Syntax:\n\n```javascript\ngetValue(jsonObject, path)\n```\n\n- `jsonObject`: The JSON object from which the value needs to be retrieved.\n- `path`: A string representing the path to the desired value. You can use dot notation (`.`) for objects and bracket\n  notation (`[]`) for arrays.\n\n#### Example:\n\n```javascript\nconst JsonCraft = require('JsonCraft'); // Assuming JsonCraft is a library for handling JSON paths\n\nconst data = {\n    user: {\n        name: \"John Doe\",\n        age: 30,\n        address: {\n            city: \"New York\",\n            postalCode: 10001\n        },\n        friends: [\n            {name: \"Jane\", age: 28},\n            {name: \"Mark\", age: 32}\n        ]\n    }\n};\n\n// Example usage with JsonCraft:\nconst name = JsonCraft.get(data, 'user.name'); // \"John Doe\"\nconst city = JsonCraft.get(data, 'user.address.city'); // \"New York\"\nconst firstFriendName = JsonCraft.get(data, 'user.friends[0].name'); // \"Jane\"\n\nconsole.log(name); // \"John Doe\"\nconsole.log(city); // \"New York\"\nconsole.log(firstFriendName); // \"Jane\"\n```\n\n---\n\n### `setValue`\n\nThe `setValue` method is used to set a value in a JSON object at a specified path. It allows you to update values within\nnested objects or arrays using dot-separated keys and bracket notation. This method is useful for modifying deeply\nnested properties in a JSON structure.\n\n#### Syntax:\n\n```javascript\nsetValue(jsonObject, path, value)\n```\n\n- `jsonObject`: The JSON object from which the value needs to be retrieved.\n- `path`: A string representing the path to the desired location where the value should be set. You can use dot\n  notation (.) for objects and bracket notation ([]) for arrays.\n- `value`: The value you want to assign to the specified path.\n\n#### Example:\n\n```javascript\nconst JsonCraft = require('JsonCraft'); // Assuming JsonCraft is a library for handling JSON paths\n\nconst data = {\n    user: {\n        name: \"John Doe\",\n        age: 30,\n        address: {\n            city: \"New York\",\n            postalCode: 10001\n        },\n        friends: [\n            {name: \"Jane\", age: 28},\n            {name: \"Mark\", age: 32}\n        ]\n    }\n};\n\n// Example usage with JsonCraft:\nJsonCraft.set(data, 'user.name', 'John Smith'); // Update user name\nJsonCraft.set(data, 'user.address.city', 'Los Angeles'); // Update city\nJsonCraft.set(data, 'user.friends[0].age', 29); // Update Jane's age\n\nconsole.log(data.user.name); // \"John Smith\"\nconsole.log(data.user.address.city); // \"Los Angeles\"\nconsole.log(data.user.friends[0].age); // 29\n```\n\n---\n\n### `hasPath`\n\nThe `hasPath` The hasPath method is used to check if a specified path exists in a JSON object. This method is helpful\nfor verifying if a value or property is present at a particular path before attempting to access or modify it. It\nsupports dot-separated keys for nested objects and bracket notation for array indices.\n\n#### Syntax:\n\n```javascript\nhasPath(jsonObject, path)\n```\n\n- `jsonObject`: The JSON object from which the value needs to be retrieved.\n- `path`: A string representing the path to the desired location where the value should be set. You can use dot\n  notation (.) for objects and bracket notation ([]) for arrays.\n\n#### Example:\n\n```javascript\nconst JsonCraft = require('JsonCraft'); // Assuming JsonCraft is a library for handling JSON paths\n\nconst data = {\n    user: {\n        name: \"John Doe\",\n        age: 30,\n        address: {\n            city: \"New York\",\n            postalCode: 10001\n        },\n        friends: [\n            {name: \"Jane\", age: 28},\n            {name: \"Mark\", age: 32}\n        ]\n    }\n};\n\n// Example usage with JsonCraft:\nconst hasCity = JsonCraft.hasPath(data, 'user.address.city'); // true\nconst hasCountry = JsonCraft.hasPath(data, 'user.address.country'); // false\nconst hasFriendAge = JsonCraft.hasPath(data, 'user.friends[0].age'); // true\n\nconsole.log(hasCity); // true\nconsole.log(hasCountry); // false\nconsole.log(hasFriendAge); // true\n```\n\n---\n\n### `deletePath`\n\nThe `deletePath` method is used to remove a property from a JSON object at a specified path. This method provides a safe\nand efficient way to delete deeply nested properties, supporting both dot-separated keys for nested objects and bracket\nnotation for array indices.\n\n#### Syntax:\n\n```javascript\ndeletePath(jsonObject, path)\n```\n\n- `jsonObject`: The JSON object from which the value needs to be retrieved.\n- `path`: A string representing the path to the desired location where the value should be set. You can use dot\n  notation (.) for objects and bracket notation ([]) for arrays.\n\n#### Example:\n\n```javascript\nconst JsonCraft = require('JsonCraft'); // Assuming JsonCraft is a library for handling JSON paths\n\nconst data = {\n    user: {\n        name: \"John Doe\",\n        age: 30,\n        address: {\n            city: \"New York\",\n            postalCode: 10001\n        },\n        friends: [\n            {name: \"Jane\", age: 28},\n            {name: \"Mark\", age: 32}\n        ]\n    }\n};\n\n// Example usage with JsonCraft:\nJsonCraft.deletePath(data, 'user.address.city');\nJsonCraft.deletePath(data, 'user.friends[0].name');\n\nconsole.log(data);\n/*\n{\n    user: {\n        name: \"John Doe\",\n        age: 30,\n        address: {\n            postalCode: 10001\n        },\n        friends: [\n            { age: 28 },\n            { name: \"Mark\", age: 32 }\n        ]\n    }\n}\n*/\n```\n\n---\n\n### `deepClone`\n\nThe `deepClone` method is used to create a deep copy of a JSON object. This means that all levels of the object,\nincluding nested objects and arrays, are copied. The cloned object is completely independent of the original, so changes\nmade to one will not affect the other.\n\n#### Syntax:\n\n```javascript\ndeepClone(jsonObject)\n```\n\n- `jsonObject`: The JSON object to be cloned.\n\n#### Example:\n\n```javascript\nconst JsonCraft = require('JsonCraft'); // Assuming JsonCraft is a library for handling JSON operations\n\nconst data = {\n    user: {\n        name: \"John Doe\",\n        age: 30,\n        address: {\n            city: \"New York\",\n            postalCode: 10001\n        },\n        friends: [\n            {name: \"Jane\", age: 28},\n            {name: \"Mark\", age: 32}\n        ]\n    }\n};\n\n// Create a deep clone of the data object\nconst clonedData = JsonCraft.deepClone(data);\n\n// Modify the cloned object\nclonedData.user.name = \"Jane Doe\";\nclonedData.user.address.city = \"Los Angeles\";\nclonedData.user.friends[0].name = \"Alice\";\n\nconsole.log(data);\n/*\nOriginal object remains unchanged:\n{\n    user: {\n        name: \"John Doe\",\n        age: 30,\n        address: {\n            city: \"New York\",\n            postalCode: 10001\n        },\n        friends: [\n            { name: \"Jane\", age: 28 },\n            { name: \"Mark\", age: 32 }\n        ]\n    }\n}\n*/\n\nconsole.log(clonedData);\n/*\nCloned object with modifications:\n{\n    user: {\n        name: \"Jane Doe\",\n        age: 30,\n        address: {\n            city: \"Los Angeles\",\n            postalCode: 10001\n        },\n        friends: [\n            { name: \"Alice\", age: 28 },\n            { name: \"Mark\", age: 32 }\n        ]\n    }\n}\n*/\n```\n\n---\n\n### `mergeObjects`\n\nThe `mergeObjects` The mergeObjects method is used to recursively merge two JSON objects. This method takes two JSON\nobjects as input and combines their properties. If the same key exists in both objects, the value from the second object\nwill overwrite or extend the value from the first, allowing for a comprehensive merging of nested objects.\n\n#### Syntax:\n\n```javascript\nmergeObjects(targetObject, sourceObject)\n```\n\n- `targetObject`: The base JSON object that will receive new or updated properties from the source.\n- `sourceObject`: The JSON object whose properties will be merged into the target object.\n\n#### Example:\n\n```javascript\nconst JsonCraft = require('JsonCraft'); // Assuming JsonCraft is a library for handling JSON operations\n\nconst data1 = {\n    user: {\n        name: \"John Doe\",\n        age: 30,\n        address: {\n            city: \"New York\",\n            postalCode: 10001\n        },\n        preferences: {\n            newsletter: true,\n            notifications: true\n        }\n    }\n};\n\nconst data2 = {\n    user: {\n        age: 31, // Overwrites age in data1\n        address: {\n            state: \"NY\" // Adds new key within address in data1\n        },\n        preferences: {\n            notifications: false // Overwrites notifications preference\n        },\n        friends: [\"Jane\", \"Mark\"] // Adds new key entirely\n    }\n};\n\n// Merge data2 into data1\nconst mergedData = JsonCraft.mergeObjects(data1, data2);\n\nconsole.log(mergedData);\n/*\nMerged object:\n{\n    user: {\n        name: \"John Doe\",\n        age: 31,\n        address: {\n            city: \"New York\",\n            postalCode: 10001,\n            state: \"NY\"\n        },\n        preferences: {\n            newsletter: true,\n            notifications: false\n        },\n        friends: [\"Jane\", \"Mark\"]\n    }\n}\n*/\n```\n\n---\n\n### `mapKeyTypes`\n\nThe `mapKeyTypes` method generates a mapping of each key in a JSON object to its corresponding data type. This function\nis useful for analyzing the structure of JSON data, especially in cases where you need to know the types of values\nstored at each key, such as for validation, debugging, or dynamic form generation.\n\n#### Syntax:\n\n```javascript\nmapKeyTypes(jsonObject)\n```\n\n- `jsonObject`: The JSON object from which you want to derive the key-type mappings.\n\n#### Example:\n\n```javascript\nconst JsonCraft = require('JsonCraft'); // Assuming JsonCraft is a library for handling JSON operations\n\nconst data = {\n    user: {\n        name: \"John Doe\",\n        age: 30,\n        address: {\n            city: \"New York\",\n            postalCode: 10001\n        },\n        friends: [\n            {name: \"Jane\", age: 28},\n            {name: \"Mark\", age: 32}\n        ]\n    },\n    isActive: true,\n    tags: [\"developer\", \"designer\"]\n};\n\n// Map each key to its data type\nconst typeMapping = JsonCraft.mapKeyTypes(data);\n\nconsole.log(typeMapping);\n/*\nOutput:\n{\n    user: \"object\",\n    \"user.name\": \"string\",\n    \"user.age\": \"number\",\n    \"user.address\": \"object\",\n    \"user.address.city\": \"string\",\n    \"user.address.postalCode\": \"number\",\n    \"user.friends\": \"array\",\n    \"user.friends[0]\": \"object\",\n    \"user.friends[0].name\": \"string\",\n    \"user.friends[0].age\": \"number\",\n    \"user.friends[1]\": \"object\",\n    \"user.friends[1].name\": \"string\",\n    \"user.friends[1].age\": \"number\",\n    isActive: \"boolean\",\n    tags: \"array\",\n    \"tags[0]\": \"string\",\n    \"tags[1]\": \"string\"\n}\n*/\n```\n\n---\n\n### `updateValue`\n\nThe `updateValue` method updates the value at a specified path within a JSON object, allowing for easy modification of\ndeeply nested properties.\n\n#### Syntax:\n\n```javascript\nupdateValue(jsonObject, path, newValue)\n```\n\n- `jsonObject`: The JSON object where the value will be updated.\n- `path`: A string specifying the path to the value you want to update (using dot notation for objects and brackets for\n  arrays).\n- `newValue`: The new value to be assigned to the specified path.\n\n#### Example:\n\n```javascript\nconst JsonCraft = require('JsonCraft'); // Assuming JsonCraft is a library for handling JSON paths\n\nconst data = {\n    user: {\n        name: \"John Doe\",\n        age: 30,\n        address: {\n            city: \"New York\",\n            postalCode: 10001\n        }\n    }\n};\n\n// Example usage with JsonCraft:\nJsonCraft.updateValue(data, 'user.address.city', 'Los Angeles');\nconsole.log(data);\n// Output: \n// {\n//   user: {\n//     name: \"John Doe\",\n//     age: 30,\n//     address: {\n//       city: \"Los Angeles\",\n//       postalCode: 10001\n//     }\n//   }\n// }\n```\n\n---\n\n### `renameKey`\n\nThe `renameKey` method renames a specified key within a JSON object. This is useful for changing the structure of JSON\ndata without altering its content.\n\n#### Syntax:\n\n```javascript\nrenameKey(jsonObject, path, newKeyName)\n```\n\n- `jsonObject`: The JSON object containing the key to rename.\n- `path`: A string specifying the path to the key you want to rename (using dot notation for objects and brackets for\n  arrays).\n- `newKeyName`: The new name to assign to the specified key.\n\n#### Example:\n\n```javascript\nconst JsonCraft = require('JsonCraft'); // Assuming JsonCraft is a library for handling JSON paths\n\nconst data = {\n    user: {\n        name: \"John Doe\",\n        age: 30,\n        contact: {\n            email: \"john.doe@example.com\",\n            phone: \"123-456-7890\"\n        }\n    }\n};\n\n// Example usage with JsonCraft:\nJsonCraft.renameKey(data, 'user.contact.phone', 'mobile');\nconsole.log(data);\n// Output: \n// {\n//   user: {\n//     name: \"John Doe\",\n//     age: 30,\n//     contact: {\n//       email: \"john.doe@example.com\",\n//       mobile: \"123-456-7890\"\n//     }\n//   }\n// }\n```\n\n---\n\n### `flatten`\n\nThe `flatten` method converts a nested JSON object into a single-level object, where each key represents the path to the\noriginal nested value. This can simplify working with deeply nested data structures.\n\n#### Syntax:\n\n```javascript\nflatten(jsonObject)\n```\n\n- `jsonObject`: The JSON object you want to flatten.\n\n#### Example:\n\n```javascript\nconst JsonCraft = require('JsonCraft'); // Assuming JsonCraft is a library for handling JSON paths\n\nconst data = {\n    user: {\n        name: \"John Doe\",\n        address: {\n            city: \"New York\",\n            postalCode: 10001\n        },\n        friends: [\n            {name: \"Jane\", age: 28},\n            {name: \"Mark\", age: 32}\n        ]\n    }\n};\n\n// Example usage with JsonCraft:\nconst flattenedData = JsonCraft.flatten(data);\nconsole.log(flattenedData);\n// Output:\n// {\n//   \"user.name\": \"John Doe\",\n//   \"user.address.city\": \"New York\",\n//   \"user.address.postalCode\": 10001,\n//   \"user.friends[0].name\": \"Jane\",\n//   \"user.friends[0].age\": 28,\n//   \"user.friends[1].name\": \"Mark\",\n//   \"user.friends[1].age\": 32\n// }\n```\n\n---\n\n### `unflatten`\n\nThe `unflatten` method takes a flattened JSON object with dot- or bracket-notated keys and reconstructs it into its\noriginal nested structure. This is useful when working with flattened data that needs to be organized back into a\nhierarchical format.\n\n#### Syntax:\n\n```javascript\nunflatten(flattenedObject)\n```\n\n- `jsonObject`: The flattened JSON object you want to convert back to its nested structure.\n\n#### Example:\n\n```javascript\nconst JsonCraft = require('JsonCraft'); // Assuming JsonCraft is a library for handling JSON paths\n\nconst flattenedData = {\n    \"user.name\": \"John Doe\",\n    \"user.address.city\": \"New York\",\n    \"user.address.postalCode\": 10001,\n    \"user.friends[0].name\": \"Jane\",\n    \"user.friends[0].age\": 28,\n    \"user.friends[1].name\": \"Mark\",\n    \"user.friends[1].age\": 32\n};\n\n// Example usage with JsonCraft:\nconst nestedData = JsonCraft.unflatten(flattenedData);\nconsole.log(nestedData);\n// Output:\n// {\n//   user: {\n//     name: \"John Doe\",\n//     address: {\n//       city: \"New York\",\n//       postalCode: 10001\n//     },\n//     friends: [\n//       { name: \"Jane\", age: 28 },\n//       { name: \"Mark\", age: 32 }\n//     ]\n//   }\n// }\n```\n\n---\n\n### `isEmpty`\n\nThe `isEmpty` method checks whether an object (or array) is empty. An empty object has no keys, and an empty array has\nno elements. This method is useful when you want to validate whether a JSON object or array contains any meaningful\ndata.\n\n#### Syntax:\n\n```javascript\nisEmpty(value)\n```\n\n- `value`: The object or array to check.\n\n#### Example:\n\n```javascript\nconst JsonCraft = require('JsonCraft'); // Assuming JsonCraft is a library for handling JSON paths\n\nconst emptyObject = {};\nconst nonEmptyObject = {name: \"John\", age: 30};\nconst emptyArray = [];\nconst nonEmptyArray = [1, 2, 3];\n\n// Example usage with JsonCraft:\nconsole.log(JsonCraft.isEmpty(emptyObject)); // true\nconsole.log(JsonCraft.isEmpty(nonEmptyObject)); // false\nconsole.log(JsonCraft.isEmpty(emptyArray)); // true\nconsole.log(JsonCraft.isEmpty(nonEmptyArray)); // false\n```\n\n---\n\n### `mergeArrays`\n\nThe `mergeArrays` method is used to merge new values into an existing array at a specified path in a JSON object. It\nensures that there are no duplicate values in the array, making it useful for maintaining unique items when adding new\nelements.\n\n#### Syntax:\n\n```javascript\nmergeArrays(jsonObject, path, newValues)\n```\n\n- `jsonObject`: The JSON object in which the array exists.\n- `path`: The path to the array in the JSON object, specified using dot notation.\n- `newValues`:The new array of values to merge into the existing array.\n\n#### Example:\n\n```javascript\nconst JsonCraft = require('JsonCraft'); // Assuming JsonCraft is a library for handling JSON paths\n\nconst data = {\n    user: {\n        name: \"John Doe\",\n        interests: [\"coding\", \"gaming\", \"reading\"]\n    }\n};\n\n// New values to merge into the interests array\nconst newInterests = [\"traveling\", \"gaming\", \"cooking\"];\n\n// Example usage with JsonCraft:\nJsonCraft.mergeArrays(data, 'user.interests', newInterests);\n\nconsole.log(data.user.interests);\n// Output: [\"coding\", \"gaming\", \"reading\", \"traveling\", \"cooking\"]\n```\n\n---\n\n### `pick`\n\nThe `pick` method is used to select specific keys from a JSON object, returning a new object that contains only the\npicked keys and their corresponding values. This is useful when you want to extract a subset of the original object.\n\n#### Syntax:\n\n```javascript\npick(jsonObject, keys)\n```\n\n- `jsonObject`: The JSON object from which to pick the keys.\n- `keys`:  An array of strings representing the keys to pick from the JSON object.\n\n#### Example:\n\n```javascript\nconst JsonCraft = require('JsonCraft'); // Assuming JsonCraft is a library for handling JSON paths\n\nconst data = {\n    user: {\n        name: \"John Doe\",\n        age: 30,\n        address: {\n            city: \"New York\",\n            postalCode: 10001\n        },\n        friends: [\n            {name: \"Jane\", age: 28},\n            {name: \"Mark\", age: 32}\n        ]\n    }\n};\n\n// Example usage with JsonCraft:\nconst pickedData = JsonCraft.pick(data, ['user.name', 'user.age']);\n\nconsole.log(pickedData);\n// Output: { user: { name: \"John Doe\", age: 30 } }\n```\n\n---\n\n### `omit`\n\nThe `omit` method removes specific keys from a JSON object, returning a new object that excludes those keys. This is\nuseful when you want to exclude certain properties while working with an object, for example, to hide sensitive data or\ncreate a simplified version of the object.\n\n#### Syntax:\n\n```javascript\nomit(jsonObject, keys)\n```\n\n- `jsonObject`: The JSON object from which to omit the specified keys.\n- `keys`: An array of strings representing the keys to be removed from the JSON object.\n\n#### Example:\n\n```javascript\nconst JsonCraft = require('JsonCraft'); // Assuming JsonCraft is a library for handling JSON paths\n\nconst data = {\n    user: {\n        name: \"John Doe\",\n        age: 30,\n        address: {\n            city: \"New York\",\n            postalCode: 10001\n        },\n        friends: [\n            {name: \"Jane\", age: 28},\n            {name: \"Mark\", age: 32}\n        ]\n    }\n};\n\n// Omitting the 'age' key from the user object\nconst userWithoutAge = JsonCraft.omit(data, ['user.age']);\n\nconsole.log(userWithoutAge);\n// Output: { user: { name: 'John Doe', address: { city: 'New York', postalCode: 10001 }, friends: [ ... ] } }\n```\n\n---\n\n### `compact`\n\nThe `compact` method removes all null and undefined values from a JSON object, returning a new object with these values\nexcluded. This is useful when you want to clean up an object, removing unwanted values before further processing or\nstoring it.\n\n#### Syntax:\n\n```javascript\ncompact(jsonObject)\n```\n\n- `jsonObject`: The JSON object from which null and undefined values will be removed.\n\n#### Example:\n\n```javascript\nconst JsonCraft = require('JsonCraft'); // Assuming JsonCraft is a library for handling JSON paths\n\nconst data = {\n    user: {\n        name: \"John Doe\",\n        age: null,\n        address: {\n            city: \"New York\",\n            postalCode: undefined\n        },\n        friends: [\n            {name: \"Jane\", age: 28},\n            {name: \"Mark\", age: 32}\n        ],\n        email: undefined\n    }\n};\n\n// Removing all null and undefined values\nconst cleanedData = JsonCraft.compact(data);\n\nconsole.log(cleanedData);\n// Output: { user: { name: 'John Doe', address: { city: 'New York' }, friends: [ ... ] } }\n```\n\n---\n\n### `deepEqual`\n\nThe `deepEqual` method checks whether two objects are deeply equal. This means it compares the values of all properties,\nincluding nested objects and arrays, to ensure they match exactly. This is useful for validating that two complex data\nstructures are identical in both content and structure.\n\n#### Syntax:\n\n```javascript\ndeepEqual(object1, object2)\n```\n\n- `object1`: The first object to compare.\n- `object2`: The second object to compare.\n\n#### Example:\n\n```javascript\nconst JsonCraft = require('JsonCraft'); // Assuming JsonCraft is a library for handling JSON paths\n\nconst object1 = {\n    user: {\n        name: \"John Doe\",\n        age: 30,\n        address: {\n            city: \"New York\",\n            postalCode: 10001\n        }\n    }\n};\n\nconst object2 = {\n    user: {\n        name: \"John Doe\",\n        age: 30,\n        address: {\n            city: \"New York\",\n            postalCode: 10001\n        }\n    }\n};\n\nconst object3 = {\n    user: {\n        name: \"Jane Doe\",\n        age: 25,\n        address: {\n            city: \"Los Angeles\",\n            postalCode: 90001\n        }\n    }\n};\n\n// Deep comparison\nconsole.log(JsonCraft.deepEqual(object1, object2)); // true (both objects are deeply equal)\nconsole.log(JsonCraft.deepEqual(object1, object3)); // false (the objects differ in values)\n```\n\n\n### Contact Me\n\nIf you have any questions or need further assistance, feel free to reach out! I'm always happy to help and collaborate on cool projects. You can contact me through:\n\n- **Email:** [behnammnasehi@gmail.com](mailto:behnammnasehi@gmail.com)\n- **Twitter:** [@binarybeastt](https://x.com/binarybeastt)\n- **GitHub:** [yourusername](https://github.com/binaryb3ast)\n\nLet's build something awesome together! 🚀","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinaryb3ast%2Fjsoncraft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinaryb3ast%2Fjsoncraft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinaryb3ast%2Fjsoncraft/lists"}