SymbolixAU / jsonify

R package to convert R objects to JSON
https://symbolixau.github.io/jsonify/
Other
67 stars 10 forks source link

from_json test cases #51

Closed SymbolixAU closed 5 years ago

SymbolixAU commented 5 years ago
SymbolixAU commented 5 years ago
from_json('[{"test":[]}]')
#   test
# 1 NULL

to_json( from_json('[{"test":[]}]') )
# [{"test":[]}]
from_json('[{"test":{}}]')
#   test
# 1 NULL

to_json( from_json('[{"test":{}}]') )
# [{"test":{}}]
to_json( from_json('[{"test":[[],[]]},{"test":[[],[]]}]') ) 
# [{"test":[[],[]]},{"test":[[],[]]}]
to_json( from_json('[{"test":[{}]},{"test":[[],[]]}]') ) 
# [{"test":[{}]},{"test":[[],[]]}]
to_json( from_json('[{"test":[{}]},{"test":[{}]}]') ) 
# [{"test":[{}]},{"test":[{}]}]
res <- from_json('https://raw.githubusercontent.com/SymbolixAU/data/master/geojson/SA1_2016_ACT.json')

class( res )
# [1] "data.frame"

head( res$properties[, c("GCC_CODE16","SA4_NAME16")] )
#   GCC_CODE16                   SA4_NAME16
# 1      8ACTE Australian Capital Territory
# 2      8ACTE Australian Capital Territory
# 3      8ACTE Australian Capital Territory
# 4      8ACTE Australian Capital Territory
# 5      8ACTE Australian Capital Territory
# 6      8ACTE Australian Capital Territory