0
Array
(
    [0] => {"vpg_id":"2","profile_id":"WEBCEO_1","project_id":"6b9d7206"}
    [1] => {"vpg_id":"2","profile_id":"WEBCEO_6","project_id":"896fb06f"}
    [2] => {"vpg_id":"2","profile_id":"WEBCEO_8","project_id":"90f33ff3"}
    [3] => {"vpg_id":"2","profile_id":"WEBCEO_9","project_id":"ca43eaff"}
    [4] => {"vpg_id":"2","profile_id":"WEBCEO_13","project_id":"9c2eeee1"}
    [5] => {"vpg_id":"2","profile_id":"WEBCEO_14","project_id":"57cf900e"} 
)

how to make this into a string like following

{"vpg_id":"2","profile_id":"WEBCEO_1","project_id":"6b9d7206"}
{"vpg_id":"2","profile_id":"WEBCEO_6","project_id":"896fb06f"}
{"vpg_id":"2","profile_id":"WEBCEO_8","project_id":"90f33ff3"}
{"vpg_id":"2","profile_id":"WEBCEO_9","project_id":"ca43eaff"}
{"vpg_id":"2","profile_id":"WEBCEO_14","project_id":"57cf900e"} 

using JSON and PHP

3
  • implode on PHP_EOL. Commented Sep 27, 2017 at 6:23
  • 1
    Possible duplicate of Transforming array to JSON - PHP Commented Sep 27, 2017 at 6:25
  • Use the json_encode method! Commented Sep 27, 2017 at 6:47

2 Answers 2

0

use php's function json_encode :

json_encode($array)

or implode it with new-line :

implode("\n", $array);
Sign up to request clarification or add additional context in comments.

Comments

-1

check -> json_encode use

json_encode($array);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.