在laravel中将请求转换为Json

I want to store several requests that comes from a form to single column as json. I know i can use toJson but that's in case you returning data from database. In my case my data comes from a form like $request->input('address_id'); and more.

//incoming data
array:8 [▼
  "address_id" => "3"
  "weight" => "3"
  "shipping_cost" => "9000"
]

This data above is just sample (i have more inputs but let say i only need to make JSON of this 3 inputs)

How can I do that?

In this case you can use the php function json encode like this:

json_encode($request->input('address_id'));

you can convert your form fields into json like

json_encode($request->all());