Fix custom json function

Use correct cycle to check if array is numerical or map
Add tests to CompatTest