Skip to content

StayDistributed/amazon-api-gateway-querystring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

amazon-api-gateway-querystring

Utility for parse nested parameters in query strings

To transform plain nested params in object inside querystring:

var mapQueryString = require('amazon-api-gateway-querystring');
event.queryStringParameters = mapQueryString(event.queryStringParameters);
event.queryStringParameters = {
  "person[0][name]": "Mark",
  "person[0][age]": 32,
  "person[1][name]": "Luke",
  "person[1][age]": 26,
  "contacts[home][phone]": "+3333333333",
  "contacts[home][email]": "[email protected]",
  "contacts[home][twitter]": "@username"
}

// become:

event.queryStringParameters = {
  "person": [{
    "name": "Mark",
    "age": 32
  }, {
    "name": "Luke",
    "age": 26
  }],
  "contacts": {
    "home": {
      "phone": "+3333333333",
      "email": "[email protected]",
      "twitter": "@username"
    }
  }
}

About

Utility for parse nested parameters in query strings

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published