{"id":21813668,"url":"https://github.com/gigaherz/jsonmerger","last_synced_at":"2026-05-08T11:06:34.752Z","repository":{"id":49327018,"uuid":"294962239","full_name":"gigaherz/JsonMerger","owner":"gigaherz","description":"A mod/coremod that enables merging json files that would normally overwrite","archived":false,"fork":false,"pushed_at":"2022-07-24T13:51:44.000Z","size":180,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-26T06:09:21.102Z","etag":null,"topics":["coremod","forge","java","json","json-merger","loot","loot-tables","minecraft","modding","modification"],"latest_commit_sha":null,"homepage":"https://www.curseforge.com/minecraft/mc-mods/json-merger","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gigaherz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-12T14:41:02.000Z","updated_at":"2024-08-24T23:11:29.000Z","dependencies_parsed_at":"2022-09-16T18:40:22.191Z","dependency_job_id":null,"html_url":"https://github.com/gigaherz/JsonMerger","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gigaherz%2FJsonMerger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gigaherz%2FJsonMerger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gigaherz%2FJsonMerger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gigaherz%2FJsonMerger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gigaherz","download_url":"https://codeload.github.com/gigaherz/JsonMerger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244768888,"owners_count":20507353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["coremod","forge","java","json","json-merger","loot","loot-tables","minecraft","modding","modification"],"created_at":"2024-11-27T14:31:42.946Z","updated_at":"2026-05-08T11:06:29.716Z","avatar_url":"https://github.com/gigaherz.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Json Merger\n=============\n\nA small server-only (works on clients) mod that enables loading a combined version of the jsons,\nfor json files that are normally \"last man wins\".\nThis is done through a patching mechanism, where jsons can manually specify they should act in \"merge\" mode instead of\nthe default \"overwrite\" mode. Fine-tuning can be achieved by specifying merge/overwrite/delete in the individual children.\n\nSee the [How to Use](#how-to-use-it) section below, for more details.\n\n## What this mod it allows\n\nThis mod enables merging for:\n* Loot tables\n* Advancements\n* Recipes\n* Biomes*\n* Dimensions*\n* Structures*\n\n\\* This mod CANNOT modify the default dimension/biome/structure definitions, only allows merging between json files. \nThis means if you want to patch the vanilla defaults, you will need to first export the vanilla defaults to json (or use an existing vanilla-defaults datapack),\nand then provide the patch files in your datapack.  \n\n## How it works\n\nJson Merger has a small coremod that patches two method calls:\n\n1. The call to `JSONUtils.fromJson` in `JsonReloadListener#prepare`, which handles loading datapack jsons such as loot tables.\n2. The call to `JsonParser#prepare` in the `func_241879_a` method from the anonymous impl of `WorldSettingsImport.IResourceAccess` contained in `func_244345_a`,\n which handles loading the json files for worldgen settings.\n\n## How to use it\n\nThis feature is available on specific supported json files (eg, loot tables).\n\nJson objects can contain a \"_jm_combine\" key, which should itself be a json object. \n\nBy default, all json files start in \"overwrite\" mode, which returns the file as-is, maintaining the default vanilla behaviour. \n\nCertain alternative modes are available depending on the element type.\n\n### Objects:\n\n- Combine: The two objects are combined, processing the child elements recursively.\n\n### Arrays:\n\n- Combine: The two arrays are combined, processing the child elements recursively. When in combine mode, array elements can have special modes to choose what to replace, or where to insert.\n- Zip: The two arrays are combined pairwise, combining each pair of elements into a new element.\n\n### Child elements within arrays:\n\n- Append (default): The element is added to the end of the list.\n- Overwrite: The element with either the specified index, or the specified search pattern, gets replaced.\n- Combine: Same as replace, but combines the existing value instead of overwriting.\n- Insert: The element is inserted at the position with the specified index.\n\n### How it's processed\n\nThe process begins at the root object, which defaults to \"overwrite\". If this object is set to \"combine\" instead, the merger will iterate through the key sets of both the original and the new, combining values for keys that exist on both objects. Children of combined objects inherit the combine mode, but they can choose to overwrite instead, by specifying this explicitly.\n\nFor arrays, the combine operation adds elements to the array, without combining them. However those child elements can specify their own mode, in which case the element will either be inserted at a chosen location, will replace (overwrite) and existing value, or will be combined with an existing value. This behaviour is guided either by index, or by search pattern.\n\nFor all other data types (primitives, null), overwrite and combine act the same: the element is returned as-is.\n\n### Controlling the insertion behaviour for non-object elements\n\nSince only json objects can contain the \"_jm_combine\" key, another feature is available: any object which has the \"_jm_combine\" key, and inside has a \"value\" key, the contents of this value key are used, instead of the object. This allows inserting/replacing arrays, strings, or other primitives, contained within other arrays, or controlling the mode of values in individual keys within an object.\n\nThat is, the following object: \n\n```json\n{\n  \"_jm_combine\": { \"value\": 1 }\n}\n```\n\nis equivalent to the primitive `1`. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgigaherz%2Fjsonmerger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgigaherz%2Fjsonmerger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgigaherz%2Fjsonmerger/lists"}