fixed potenial crash
pretected jsonencode to not crash or fail on unsupported types in the dictionaries to be converted