Wiki 9Minecraft Wiki 9Minecraft

Trade Syntax Guide

Java EditionModGuides 5FAQ 10Related mods 60
DownloadVillager Trade Tables Mod

Get the files on 9Minecraft

Contents (5)
  1. Item Object Properties
  2. Quantity Ranges
  3. Example Trade JSON
  4. Next guides
  5. More in this wiki

Items in the JSON files are defined as objects. This allows for high precision when specifying trade requirements.

Item Object Properties

  • id: The registry name of the item (e.g., minecraft:emerald).
  • Damage: The metadata or durability value of the item.
  • Count: The number of items. This can be a single integer or a range object.
  • NBT: A string representation of the item's NBT data (e.g., "{display:{Name:\"Legendary Sword\"}}").

Quantity Ranges

Instead of a fixed number, you can provide a range to randomize the trade costs:

"Count": { "min": 1, "max": 5 }

Example Trade JSON

Below is an example of a trade that adds a custom transaction to the Cleric career:

{
 "Profession": "minecraft:cleric",
 "Career": "cleric",
 "Offers": [
 {
 "action": "add",
 "CareerLevel": 1,
 "buy": { "id": "minecraft:rotten_flesh", "Count": 32 },
 "sell": { "id": "minecraft:emerald", "Count": 1 }
 }
 ]
}