thread the to_json opts correctly