Skip to main content

JSON Importer Guide

The JSON Importer is an useful tool that allows you to bulk import games from external sources into CloudArcade. This guide explains how to use it effectively and avoid common pitfalls.

Overview

The JSON Importer enables you to:

  • Import multiple games simultaneously using JSON data
  • Preview games before importing them
  • Migrate games from other CMS platforms to CloudArcade
  • Maintain game metadata consistency during import

JSON Structure Requirements

Your JSON data must be an array of game objects. Each game object requires these fields:

[
    {
        "title": "Game name 1",
        "description": "Game description",
        "instructions": "How to play instructions",
        "url": "https://example.com/game-path/",
        "width": 720,
        "height": 1080,
        "thumb_1": "https://cdn.redfoc.com/portfolio/checkers.jpg",
        "thumb_2": "https://cdn.redfoc.com/portfolio/checkers.jpg",
        "category": "Category1,Category2",
        "is_mobile": true,
        "source": "json-importer"
    },
    {
        "title": "Game name 2",
        "description": "Game description",
        "instructions": "How to play instructions",
        "url": "https://example.com/game-path/",
        "width": 720,
        "height": 1080,
        "thumb_1": "https://cdn.redfoc.com/portfolio/checkers.jpg",
        "thumb_2": "https://cdn.redfoc.com/portfolio/checkers.jpg",
        "category": "Category1,Category2",
        "is_mobile": true,
        "source": "json-importer"
    },
    {
        "title": "Game name 3",
        "description": "Game description",
        "instructions": "How to play instructions",
        "url": "https://example.com/game-path/",
        "width": 720,
        "height": 1080,
        "thumb_1": "https://cdn.redfoc.com/portfolio/checkers.jpg",
        "thumb_2": "https://cdn.redfoc.com/portfolio/checkers.jpg",
        "category": "Category1,Category2",
        "is_mobile": true,
        "source": "json-importer"
    }
]

Optional Fields

  • slug: URL-friendly version of title (auto-generated if omitted)

Common Issues and Solutions

  1. Import Failures
    • Verify JSON syntax is valid
    • Check all required fields are present
    • Ensure URLs are properly formatted and accessible
  2. Image Problems
    • Confirm thumbnail URLs are direct image links
    • Verify image formats are supported (jpg, png, webp)
    • Check image dimensions match requirements

JSON Compatibility and Conversion

Not all JSON data structures from other platforms will be directly compatible with CloudArcade. You’ll need to ensure your JSON matches CloudArcade’s required structure before importing.

Options for converting incompatible JSON:

  1. External Tools
    • Use online JSON transformation tools like jq
    • CSV to JSON converters if your data is in spreadsheet format
    • JSON editors with search/replace functionality
  2. Custom Code Solutions
    • Write a PHP script to transform your JSON
    • Use Python with libraries like pandas for data transformation
    • Create a JavaScript converter using Node.js

Example PHP converter:

function convertToCloudArcadeFormat($originalJson) {
    $data = json_decode($originalJson, true);
    $converted = [];
    
    foreach ($data as $item) {
        $converted[] = [
            'title' => $item['game_name'] ?? '', // Original key: game_name
            'description' => $item['game_desc'] ?? '', // Original key: game_desc
            'instructions' => $item['how_to_play'] ?? '', // Original key: how_to_play
            'url' => $item['game_url'] ?? '',
            'width' => $item['dimensions']['width'] ?? 720,
            'height' => $item['dimensions']['height'] ?? 1080,
            'thumb_1' => $item['images'][0] ?? '',
            'thumb_2' => $item['images'][1] ?? '',
            'category' => implode(',', $item['tags'] ?? []),
            'is_mobile' => '1',
            'source' => 'converted-data'
        ];
    }
    
    return json_encode($converted, JSON_PRETTY_PRINT);
}

Migration Tips

When migrating from another platform:

Use the Preview feature before final import

Export your game data in JSON format

Map existing fields to CloudArcade’s structure

Transform the data to match required format