Execute 1 credit COMPUTE

Transform JSON Array Items API

Apply a transformation to each item in a JSON array using a field mapping spec: pick fields, rename fields, add computed fields (string templates, math expressions on other fields), and drop fields. Available as a simple REST API — POST your input, get structured JSON back. 1 credit per call, no rate limiting, works in any language with HTTP support.

Try it live →

How it works

POST a JSON object with your input data to /v1/exec-map-json. The API processes your request server-side using real computation (not mocked data) and returns a structured JSON response with your results and metadata including credits used and processing time.

Use cases

API Reference

POST https://slopshop.gg/v1/exec-map-json
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Input parameters

ParameterTypeRequiredDescription
input string | object required The input data to process

Example response

{
  "data": {
    "result": 42,
    "console": [],
    "execution_ms": 3
  },
  "meta": {
    "credits_used": 1,
    "engine": "real",
    "ms": 4
  }
}

Examples

Three real-world scenarios showing how developers use Transform JSON Array Items in production.

Example 1
Run a simple expression
Execute a basic JavaScript expression in the sandbox.
curl -X POST https://slopshop.gg/v1/exec-map-json \
  -H "Authorization: Bearer $SLOPSHOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"code": "return 2 + 2;"}'
Example 2
Run a data transformation
Execute an array transformation in the sandboxed environment.
curl -X POST https://slopshop.gg/v1/exec-map-json \
  -H "Authorization: Bearer $SLOPSHOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"code": "const data = [1, 2, 3, 4, 5]; return data.map(x => x * x);"}'
Example 3
Run a string operation
Execute string manipulation code safely in the sandbox.
curl -X POST https://slopshop.gg/v1/exec-map-json \
  -H "Authorization: Bearer $SLOPSHOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"code": "const s = 'hello world'; return s.split(' ').map(w => w[0].toUpperCase() + w.slice(1)).join(' ');"}'

Code examples

curl

curl -X POST https://slopshop.gg/v1/exec-map-json \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input": "your data here"}'

Python

import requests

response = requests.post(
    "https://slopshop.gg/v1/exec-map-json",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={"input": "your data here"}
)
result = response.json()
print(result["data"])

Node.js

const response = await fetch("https://slopshop.gg/v1/exec-map-json", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ input: "your data here" })
});
const { data } = await response.json();
console.log(data);

CLI

# Install the Slopshop CLI
npm install -g slopshop

# Set your API key
export SLOPSHOP_KEY=your_api_key

# Call exec-map-json
slop exec-map-json '{"input": "your data here"}'

Pricing

Credits per call
1
credits
Cost per call
$0.001
at Starter tier
Tier
COMPUTE
Pure compute

Credits are purchased in bundles starting at $1 for 1,000 credits. All compute APIs like this one use 1 credit per call — that's $0.001. See all pricing tiers.

Related APIs in Execute

View the full API catalog · Try in playground · Documentation