New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@aux4/adapter

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aux4/adapter

Adapt JSON/XML input to a predefined JSON output

latest
Source
npmnpm
Version
0.2.13
Version published
Maintainers
1
Created
Source

@aux4/adapter

Install

$ npm install --global @aux4/adapter

Usage

config.yml

config:
  my-mapping:
    transformers:
      GENDER:
        type: replace
        replace:
          M: MALE
          F: FEMALE
      DATE:
        type: date
        format: MM/DD/YYYY
    
    root:
      path: $.data
    mapping:
      name: $.name
      age: $.age
      birthdate:
        path: $.birthdate
        transformer: DATE
      gender:
        path: $.gender
        transformer: GENDER
      place:
        type: object
        mapping:
          city: $.address.city

test.json

{
  "data": [
    {
      "name": "John",
      "age": 31,
      "birthdate": "1992-04-10",
      "gender": "M",
      "address": {
        "city": "New York"
      }
    },
    {
      "name": "Mary",
      "age": 27,
      "birthdate": "1996-02-14",
      "gender": "F",
      "address": {
        "city": "Boston"
      }
    }
  ]
}
$ cat test.json | adapter map --config my-mapping --format json

[
  {
    "name": "John",
    "age": 31,
    "birthdate": "04/10/1992",
    "gender": "MALE",
    "place": {
      "city": "New York"
    }
  },
  {
    "name": "Mary",
    "age": 27,
    "birthdate": "02/14/1996",
    "gender": "FEMALE",
    "place": {
      "city": "Boston"
    }
  }
]

Keywords

json

FAQs

Package last updated on 22 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts