From 0a476f245aab63f4cf11a12987dece576ee7bfb1 Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Fri, 10 Aug 2018 23:00:47 +0800 Subject: [PATCH] Fix json_encode issue with decimal / integer encoding #162 --- src/Ramcar/APIResult.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Ramcar/APIResult.php b/src/Ramcar/APIResult.php index 33eb407b..e54963c2 100644 --- a/src/Ramcar/APIResult.php +++ b/src/Ramcar/APIResult.php @@ -2,7 +2,7 @@ namespace App\Ramcar; -use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\Response; class APIResult { @@ -68,7 +68,8 @@ class APIResult 'data' => $this->data ]; - $json = new JsonResponse($return_data); + $json_data = json_encode($return_data, JSON_NUMERIC_CHECK); + $json = new Response($json_data); return $json; }