npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sonatel-os/json-sculpt

v1.3.0

Published

Declarative JSON transformation engine that reshapes and maps complex data structures with nested resolution, type casting, recursion, and more. Ideal for APIs, SDKs, and frontend shaping.

Readme

🎨 JSON Sculptor — Mapping Made Declarative

npm npm downloads license

Your API responses deserve better than res.data?.items?.[0]?.name. Let’s sculpt them into shape — predictably, declaratively, and with joy."

🚀 What Is It?

@sonatel-os/json-sculpt is a minimalist mapping engine that reshapes any JSON into any structure you define — with support for:

  • 📌 Declarative templates
  • 🧠 Nested paths
  • 🧰 Array transformations
  • 🧪 Inline type casting (::type)
  • ⚙️ Default/fallback values — NEW!
  • 🧱 Dynamic keys — NEW!
  • 🔁 Recursive mappings — NEW!
  • 🧩 Flattened output via $spread — NEW!
  • ⚡ Combined transformation modes

📦 Installation

Install via npm:

npm install @sonatel-os/json-sculpt
# or
yarn add @sonatel-os/json-sculpt

📖 Basics

🛠 Basic Usage

import { sculpt } from '@sonatel-os/json-sculpt';

const template = {
  name: '@link.user.name',
  email: '@link.user.email',
  city: '@link.address.city',
};

const input = {
  user: { name: 'Alice', email: '[email protected]' },
  address: { city: 'Wonderland' },
};

const result = sculpt.data({ data: input, to: template });

console.log(result);
// { name: 'Alice', email: '[email protected]', city: 'Wonderland' }

🧪 Type Casting with ::type

const template = {
  age: '@link.profile.age::number',
  isActive: '@link.flags.subscribed::boolean',
  registeredAt: '@link.meta.createdAt::date',
};

✅ Supported types: string, number, boolean, date, array, object

📚 Array Mapping

const template = {
  product: '@link.name',
  variants: {
    $map: '@link.variants',
    $transform: {
      color: '@link.color',
      inStock: '@link.stock::boolean',
    }
  },
  flatColors: {
    $map: '@link.variants',
    $extract: '@link.color'
  }
};

🧠 Advanced Features

🧱 Dynamic Keys — NEW!

const template = {
  product: '@link.name',
  ['@link.sku']: '@link.name',
  variants: {
    $map: '@link.variants',
    $transform: {
      ['@link.color']: '@link.stock::boolean',
    }
  }
};
  • ✅ Works anywhere — top-level or nested
  • ✅ No special syntax needed

🧩 Flattened Mapped Output ($spread) — NEW!

const template = {
  product: '@link.name',
  variantsInStock: {
    $map: '@link.variants',
    $spread: {
      ['@link.color']: '@link.stock::boolean'
    }
  }
};

🔁 Recursive Mapping — NEW!

const template = {
  components: {
    $map: '@link.content',
    $transform: {
      name: '@link.type',
      props: '@link.props',
      children: {
        $recursive: {
          $track: '#content',
          $rename: 'children',
          name: '@link.type',
          props: '@link.props'
        }
      }
    }
  }
};

🌀 Dynamic Path Resolution (Fallbacks) — NEW!

const template = {
  username: ['@link.user.username', '@link.user.email', '[email protected]'],
};

🧪 Pro Tip: Function-Based $op

Extend Sculptor with custom operators for ultra-specific transforms.

sculpt.registry('toCamelCase', (carriers, args, parent, ctx) => {})

const template = {
  airlineNames: {
    $op: 'toCamelCase',
    $from: '@link.carriers'
  }
};

🤝 Contribute

Have an idea or feature request? Open a GitHub issue or submit a PR!

🏷 License

Licensed under the MIT License.

👨‍🎨 Author

Mohamed Johnson (LPIX-11)
Crafting clean, smart tools for devs who care.