skip to Main Content

How can I insert json string to MongoDB?

I have a json string. Like this: "{"http_requests":[{"http_requests":{"code":"400","method":"PUT","value":89}},{"http_requests":{"code":"200","method":"PUT","value":45}}]}" I want to insert this json to mongodb. But I have error in my code. The error is "cannot transform type string to a BSON Document: WriteString can only write while positioned…

VIEW QUESTION

Search in JSON with PHP

I want to search inside a JSON file with the following format: { "success": true, "msg": "", "obj": [ { "id": 1, "up": 546636462, "down": 4172830061, "total": 53687091200, "name": "حامد ", "enable": true, "expiryTime": 1667049201686, "listen": "", "dork": 23050, "net":…

VIEW QUESTION

How to check JSON String based on another JSON String? – PHP

I'd like to do a loop with these JSON strings. $json_m = '[ {"name":"1","value":"1"}, {"name":"2","value":"2"}, {"name":"3","value":"3"}, {"name":"4","value":"4"}, {"name":"5","value":"5"}, ]'; $json_a = '[ {"name":"1-m","value":"1"}, {"name":"2-m","value":"3"}, {"name":"3-m","value":"5"}, ]'; I do a loop and on $json_m. If the value exists in both JSON,…

VIEW QUESTION

get rid of numbers in json response (LARAVEL 8)

my function in a controller is here below public function getStudentsinGrade($grade, $school_id){ $students = Student::where('school_id', $school_id)->get(); $this -> grade = $grade; $gradeStudent= $students->filter(function($value,$key){ return $value->grade == $this->grade; }); if(count($gradeStudent) > 0){ return response()->json($gradeStudent); } else{ return response('No Registered Student'); }…

VIEW QUESTION
Back To Top
Search