check for json serializability, and use repr for values only if not serializable