0

I have a REST controller whice should return a list of companies in json format. The companies are fetched by a service. Where should i encode the result into json format? I tought of an encoder class, but where should i inject that?

Dominik Barann
  • 675
  • 2
  • 10
  • 25
  • In the same place where you would turn the list of companies in a HTML list: template. That's what view instance are using to assemble the response. – tereško Sep 04 '14 at 05:33

1 Answers1

-1

PHP Offers JSON encoding / decoding functionality built in:

http://php.net/manual/en/function.json-encode.php

$json_result = json_encode($array_to_be_encoded);