Skip to content

Examples of JSON parsing / generation and http requests in various languages

Notifications You must be signed in to change notification settings

coolaj86/json-examples

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-examples

Examples of JSON parsing / generation and http requests in various languages

Solutions Explored

  1. jQuery (in Browser, all the hard stuff is handled)
  2. NodeJS (Best HTTP and JSON support)
  3. Ruby
  4. Python
  5. GoLang
  6. luvit (lua)
  7. C#
  8. Java
  9. curl (exec from any language)
  10. bash
  11. C

ProTip: Use an Application Language (NodeJS, Python, Ruby) to do all of your HTTP / JSON work coupled with some sort of message passing (such as packing a struct) if you need to use a Systems Language (C, Java, C#). Or just do it all in Go. That would be the best language.

IMPORTANT

The parser you choose MUST be configureable meet the following criteria:

  • IGNORE unexpected and unused fields (new fields may be added at any time)
  • ACCEPT null as a non-value for any field type

Additionally:

  • when a number is encountered where a string was expected, the number should be treated as a string
  • if an expected field does not exist, it should be treated the same as if the value were null

Examples

The eventual goal is to have examples for all of the following in each language:

  • HTTP GET request
  • HTTP POST request
  • JSON parsing (decoding / deserializing)
  • Iterating over objects and arrays
  • JSON stringifying (encoding / serializing)

About

Examples of JSON parsing / generation and http requests in various languages

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 40.6%
  • C 18.2%
  • Java 12.7%
  • Python 10.9%
  • JavaScript 8.8%
  • Ruby 4.3%
  • Other 4.5%