20,919,685Total Points24,106Total Sites23,382Cell Towers69,500Racks Monitored56,753HVAC Units Monitored31,322UPS Units Monitored24,788Generators Monitored20,919,685Total Points24,106Total Sites23,382Cell Towers69,500Racks Monitored56,753HVAC Units Monitored31,322UPS Units Monitored24,788Generators Monitored20,919,685Total Points24,106Total Sites23,382Cell Towers69,500Racks Monitored56,753HVAC Units Monitored31,322UPS Units Monitored24,788Generators Monitored

Chapter 2: Core ConceptsLesson 9 of 65

How to Duplicate a Device Using JSON Export and Import

Clone a fully configured Mango by Radix IoT data source with all its points using JSON export and import, then modify only what differs for the new device.

  • 8 min read
  • Intermediate
  • Mango 4.x / 5.x

Overview

When you have multiple identical devices — generators, RTUs, meters — configuring each from scratch is slow and error-prone. Mango by Radix IoT's JSON export/import lets you clone a fully configured data source with all its points, then change only what differs (IP address, device ID, tags). A 23-point device that took an hour to configure the first time can be duplicated in under two minutes.

Prerequisites

  • A superadmin account — the Configuration import/export page and the REST import both require it
  • A fully configured, working data source with all its data points
  • A text editor that handles JSON (VS Code, Notepad++, or similar)
  • Network/protocol details for the new device (IP address, unit ID, etc.)

The 7-Step Duplication Workflow

Step 1: Export the Source Device

Open Data integration > Data sources and select the source device. Its More options menu (⋮) has two downloads: Export, which is the data source alone, and Export with points, which is the one you want. The REST API draws the same line:

# Data source ONLY -- no points
GET /rest/latest/data-sources/export/{xid}
# Data source AND its points -- what you want for duplication
GET /rest/latest/data-sources/export/{xid}?includePoints=true

Warning

includePoints defaults to false. Without it the export contains the data source and none of its data points, so the “clone” you import is an empty device. Exporting the source and exporting the source with its points are two different requests, not two names for the same one.

Save the exported JSON to a local file. The payload is shaped {"dataSources": [ … ], "dataPoints": [ … ]} — both are lists, even for a single device.

Step 2: Give the Data Source a New XID

In the exported JSON, find the data source's xid and change it to a new, unique value — for example DS_GEN_02. Do not simply delete it: Mango would then generate a random XID on import, and nothing in your file would refer to it. If you leave the original XID, the import will overwrite the existing device.

Step 3: Point Every Point at the New XID

Each point names its parent in dataSourceXid. Set it on every point to the new XID from Step 2 — that is how the points attach to the new data source. A point whose dataSourceXid is blank or matches no data source is skipped (“…references a data source that does not exist. Ignored.”), and one that still names the original XID is added to the original device.

Step 4: Remove Point XIDs

Delete or clear every individual point XID. Mango generates new unique XIDs on import. Leaving original XIDs would overwrite existing points.

Step 5: Find and Replace Device Identifiers

This is the critical step. Search the JSON for everything unique to the source device:

  • IP address (e.g., 10.1.1.100 → 10.1.1.101)
  • Device name/label
  • Tags (e.g., deviceID=Gen-1 → deviceID=Gen-2)
  • Protocol-specific ID — for Modbus this is slaveId on each point’s locator (default 1), not a single field on the data source, so a 23-point device has 23 of them
  • Point names if they contain the device identifier

Warning

Be careful with find-and-replace. If the IP is "10.1.1.1" and you replace just "1" with "2", every matching substring is rewritten — you get a still-valid JSON file with silently wrong values throughout (hosts, IDs, and unrelated fields). Always search for the full, unique string.

Step 6: Import the Modified JSON

Use Mango's Configuration import/export page (Data integration in the menu, or its button on the Utilities card of Admin home), or the REST API:

POST /rest/latest/json-emport

Mango creates the new data source under the XID you gave it, and every point with a newly generated XID. Importing reads data sources before points, so one file carrying both is fine. Over REST the import runs in the background: the response points at a status resource, GET /rest/latest/json-emport/import/{id}, that reports each item’s result.

Step 7: Verify

  • Confirm the new data source appears in the Data Sources list
  • Verify all points are created with correct configurations
  • Check that tags are correct (not still referencing old device)
  • Enable the data source and verify it polls successfully

Tip

Follow a duplicate, retag, revalidate workflow. After importing, immediately update all tags on the new device’s points to match the new device identity. Then revalidate by checking that filtered watch lists and dashboards pick up the new device correctly and do not still show stale references to the source device.

Tip

Before pushing duplicated devices to production, run a smoke test: enable the new data source, wait for two or three successful poll cycles, verify that at least a few representative points return reasonable values, and check that no error entries appear in ma.log. This 60-second check catches configuration errors before they become production issues.

Practical Example

Duplicating Generator 1 (23 data points) to create Generator 2:

FieldGenerator 1 (source)Generator 2 (new)
Data source xid (and every point’s dataSourceXid)DS_GEN_01DS_GEN_02
IP address10.1.5.1010.1.5.11
Device nameGen-1Gen-2
deviceID tagGen-1Gen-2
Modbus slaveId (on every point)12

After export, set the new data source XID on the source and on every point, clear the point XIDs, run four find-and-replace operations, import, and verify. Total time: roughly 2 minutes.

The One-Call Alternative: Copy

Before hand-editing JSON, know that Mango can duplicate a data source and its points in a single request:

PUT /rest/latest/data-sources/copy/{xid}?copyXid=DS_GEN_02&copyName=Generator%202&copyDeviceName=Gen-2&copyPoints=true&enabled=false

The copy takes copyXid (or a generated XID if you leave it out) and every copied point gets a fresh XID, so this sidesteps every XID pitfall below, and copyDeviceName sets the new points’ device name — which is also what populates the device tag. Use the JSON route when you need to change protocol details in bulk (IP address, slaveId) that copy does not take parameters for; use copy when the new device differs only by identity.

Scripted Bulk Duplication (10+ Devices)

For large deployments, automate with the REST API and a script:

# Pseudo-code for bulk device duplication
import requests, json, copy
# includePoints=true is required -- without it there are no points to clone
template = requests.get(BASE + "/rest/latest/data-sources/export/DS_GEN_01",
                        params={"includePoints": "true"}, headers=AUTH).json()
devices = [
    {"xid": "DS_GEN_02", "ip": "10.1.5.11", "name": "Gen-2", "slave_id": 2},
    {"xid": "DS_GEN_03", "ip": "10.1.5.12", "name": "Gen-3", "slave_id": 3},
    {"xid": "DS_GEN_04", "ip": "10.1.5.13", "name": "Gen-4", "slave_id": 4},
]
for dev in devices:
    clone = copy.deepcopy(template)
    # The export payload is {"dataSources": [...], "dataPoints": [...]} -- both lists
    for ds in clone.get("dataSources", []):
        ds["xid"] = dev["xid"]        # a NEW xid -- not deleted, or the points cannot find it
        ds["enabled"] = False          # verify before it starts polling
    for pt in clone.get("dataPoints", []):
        pt.pop("xid", None)            # blank point xid -> Mango generates one
        pt["dataSourceXid"] = dev["xid"]  # attach every point to the new source
        # Modbus slaveId lives on each point's locator, not on the data source
        if "pointLocator" in pt:
            pt["pointLocator"]["slaveId"] = dev["slave_id"]
    raw = json.dumps(clone)
    raw = raw.replace("10.1.5.10", dev["ip"])   # full, unique strings only
    raw = raw.replace("Gen-1", dev["name"])
    # Runs in the background: poll the status URL it returns before trusting it
    requests.post(BASE + "/rest/latest/json-emport",
                  headers=AUTH, json=json.loads(raw))

Critical Pitfalls

PitfallWhat HappensPrevention
Leaving original XIDsImport overwrites source deviceGive the data source a new XID and clear every point XID
Deleting the data source XID and the points’ dataSourceXidThe new data source imports with no pointsSet every point’s dataSourceXid to the new data source XID
Broad find-and-replaceSilently rewrites unrelated values in still-valid JSONSearch for full, unique strings only
Forgetting to update tagsNew device inherits old tags; appears in wrong dashboardsKeep a checklist of fields to update
Case sensitivity in tagsGen-1 and gen-1 don't match; filters breakAgree on case convention project-wide
Importing with data source enabledStarts polling before config is verifiedSet enabled: false in JSON; enable after verification

Troubleshooting

SymptomLikely CauseFix
Import succeeds but no new data sourceOriginal XID left in; updated existing deviceRe-export source, redo with XIDs removed
Import skips points: “…references a data source that does not exist. Ignored.”A point’s dataSourceXid is blank or does not match the new data source’s XIDSet every point’s dataSourceXid to the new XID; re-import
New points appear on the original devicePoints still carry the original dataSourceXidChange it to the new XID on every point
New device polls but returns errorsProtocol IDs still match old deviceDouble-check all protocol fields
Config looks wrong after importOver-broad find-and-replace changed unintended valuesRe-export, use full unique strings, validate JSON before importing

Summary

JSON export/import is the fastest way to duplicate devices in Mango. The key steps: export with points, give the data source a new XID and point every point at it, clear the point XIDs, replace device-specific identifiers, import, and verify. For large-scale deployments, script the process against the REST API. Get the XIDs right and always use precise find-and-replace.

Get free access to all 65 Mango by Radix IoT training lessons

One short form unlocks every lesson and its video in this browser.

This form is hosted by Zoho. It loads only after you enable support cookies or choose to load it below.

We honored your browser’s Global Privacy Control signal — optional cookies are off and nothing is tracked.