Expose $assoc param of json_decode with optional decode() param

An extra optional boolean parameter is added to the decode() function to
allow specifying whether the returned decoded objects should be
converted into associative arrays. Using json_decode for this is the
most efficient way of doing the conversion.