mi_json: complete rework of the module

consider the modules MI_IS_ARRAY hints to build a simpler JSON document
fixes cases where duplicate keys generate invalid documents
(example: ul_show_contacts)