# Uploading Game Assets with JSON Files

To allow your customers to redeem in-game assets via the whitelabel marketplace and synchronize them directly with the in-game environment, you'll need to upload two key files to the Ludo system via the **Integrations > Game Sync** button: `items.json` and `products.json`. Once these files are uploaded, you’ll map each JSON header to the corresponding columns in the system.

The system requires certain fields to ensure proper matching, and one of the critical aspects is to ensure that the **item or product ID** in the JSON matches the ID used within the game. This will enable your users to redeem and display items in-game effectively.

**Steps for Uploading and Mapping JSON Files:**

1. **Navigate to the Game Sync Section:**
   * Go to **Integrations > Game Sync** in the Ludo system.
2. **Upload `items.json` and `products.json`:**
   * Upload your JSON files containing the relevant data for in-game assets and products.
3. **Map JSON Headers to Columns:**
   * After uploading, map each JSON header to the corresponding system column in Ludo.
   * Certain fields like `itemId`, `rewardType`, and `rewardId` are required for proper functionality. Ensure the IDs match the ones used in your game environment.
4. **Complete the Integration:**
   * Once the mapping is complete, click **Save** to finalize the setup. Your in-game assets will now be synchronized with the whitelabel marketplace and reflected directly in the game.

***

**Example JSON Files:**

**`items.json`:**

```json
[
  {
    "rewardType": 1,
    "rewardId": "test-item-1",
    "nameEn": "Test Item 1",
    "descriptionEn": "This is a test item for the Marketplace.",
    "imageURL": "https://example.com/images/test-item-1.png"
  },
  {
    "rewardType": 1,
    "rewardId": "test-item-2",
    "nameEn": "Test Item 2",
    "descriptionEn": "This is another test item for the Marketplace.",
    "imageURL": "https://example.com/images/test-item-2.png"
  }
]
```

**`products.json`**:

```json
[
  {
    "id": 1,
    "nameEn": "Starter Pack",
    "descriptionEn": "A special pack for beginners.",
    "rewards": [
      { "rewardType": 10, "rewardId": 0, "rewardNum": 300 },
      { "rewardType": 3, "rewardId": 4010101, "rewardNum": 3 }
    ],
    "price": 0,
    "startsAt": 1640962800,
    "endsAt": 1640962800
  },
  {
    "id": 2,
    "nameEn": "Premium Pack",
    "descriptionEn": "A premium package with additional rewards.",
    "rewards": [
      { "rewardType": 3, "rewardId": 4130101, "rewardNum": 5 },
      { "rewardType": 3, "rewardId": 4130102, "rewardNum": 1 }
    ],
    "price": 100,
    "startsAt": 1640962800,
    "endsAt": 1640962800
  }
]
```

***

#### Displaying In-Game Items for Users

After syncing the game data, the system provides a webhook for updating in-game assets for individual players. The webhook sends data to your system with the relevant **player ID** and associated items, allowing you to show the items in-game in real-time.

**Webhook Process:**

1. **Webhook Trigger**:
   * The Ludo system sends a webhook containing the `playerId`, `itemId`, and other necessary data when an item is claimed or modified.
2. **Update Player Data**:
   * Upon receiving the webhook, update the player's in-game data by associating the received items with the corresponding `playerId`.
3. **Show Items in Game**:
   * Ensure your game backend processes the data and displays the items to the player within the game interface.

***

**Sample Webhook Data:**

```json
{
  "playerId": "123456",
  "items": [
    {
      "itemId": "ludo-test",
      "rewardType": 1,
      "rewardNum": 1
    },
    {
      "itemId": "ludo-dealer",
      "rewardType": 1,
      "rewardNum": 1
    }
  ]
}
```

For further details, refer to the Webhook Documentation for integrating this system into your game's architecture.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tryludo.com/gaming-getting-started/getting-set-up-with-custom-integration/uploading-game-assets-with-json-files.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
