json.extract! @ingredients, :total_count, :total_pages, :current_page json.page_size @ingredients.limit_value json.ingredients @ingredients do |i| json.extract! i, :id, :name, :ndbn, :kcal json.usda i.ndbn.present? if i.density.present? value = UnitConversion::parse(i.density) json.density value.convert('oz/cup').change_formatter(UnitConversion::DecimalFormatter.new).pretty_value else json.density nil end end