Fix custom json function

Use correct cycle to check if array is numerical or map
Add tests to CompatTest
Merge pull request #166 from allevo/fix/custom-json-function

Fix custom json function