Skip to content

a go package for converting json case to various cases

License

Notifications You must be signed in to change notification settings

vchitai/jsoncase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsoncase

a go package for converting json case to various cases

Godoc Reference PkgGoDev Coverage Go Report Card

Example

s := `
{
  "a_b": {
    "c_d": "e"
  },
  "b_e": "x",
  "e_f": [
    {
      "c_f": "e"
    }
  ],
  "x_y": {
    "a_b": {
      "c_d": "e"
    },
    "b_e": "x",
    "e_f": [
      {
        "c_f": "e"
      }
    ]
  }
}
`
s2 := ToCamelJson(s)
fmt.Prilntln(s2)
=> `
{
  "aB": {
    "cD": "e"
  },
  "bE": "x",
  "eF": [
    {
      "cF": "e"
    }
  ],
  "xY": {
    "aB": {
      "cD": "e"
    },
    "bE": "x",
    "eF": [
      {
        "cF": "e"
      }
    ]
  }
}
`
Function Usage
ToSnakeJson string-string
ToCamelJson string-string
ToSnakeJsonBytes []byte-[]byte
ToCamelJsonBytes []byte-[]byte
ToSnakeVal interface{} - interface{}
ToCamelVal interface{} - interface{}

Install

go get -u https://github.com/vchitai/jsoncase

About

a go package for converting json case to various cases

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages