EnderTurret / PatchedMod

A Minecraft mod that adds the ability to patch Json files for resource and data packs.
GNU Lesser General Public License v2.1
2 stars 0 forks source link

[Question] Is it possible to move an object to a property of itself? #16

Closed SettingDust closed 5 months ago

SettingDust commented 5 months ago

Like below

{
  "a": {
    "b": 1
  }
}

to

{
  "a": {
    "c": {
      "b": 1
    }
  }
}

Move the a to a.c

EnderTurret commented 5 months ago

I believe the following should work:

[
  {
    "op": "move",
    "from": "/a",
    "path": "/_temp"
  },
  {
    "op": "add",
    "path": "/a",
    "value": {}
  },
  {
    "op": "move",
    "from": "_temp",
    "path": "/a/c"
  }
]
SettingDust commented 5 months ago

Error.

图片

TraversalException: /elements/0/element/delegate: No such child delegate

SettingDust commented 5 months ago

Oh. It's working. Forget to remove the generated before