Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. return response()->json(json_decode(file_get_contents('some/path', true)));
  2.  
  3. {
  4. "ID": "123",
  5. "Date": "08/06/2012",
  6. "Amount": "�120.59"
  7. }
  8.  
  9. $data = file_get_contents('some/path', true);
  10. $encoding = mb_detect_encoding($data, mb_detect_order(), true);
  11. if($encoding !== "UTF-8") {
  12. return response()->json(json_decode(utf8_decode($data)));
  13. }
  14. return response()->json(json_decode($data));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement