Skip to content

Tag: json

Create Json array from mysql data

I need a bit of help, i have this code: which is returning and i need to return like this: Could someone helping me? I search everywhere but i don’t see how to adjust array to get needed structure Answer You’re adding an extra array layer with the []. Change the code to this:

Filter API response with PHP

Not sure what issue was with first pastebin code, here is another attempt. I am connecting to Vimeo Live API, in doing so the response is huge > 500kb in total – I have an example with only one object here -> there are over 20 it returns. I have a better idea of what Im doing in JS than

Fetch data directly from php to flutter

I’m currently working on a Flutter project with php mysql as the backend. Is there anyway that I could possibly fetch data directly from php file? I’m so clueless. For example, how do I fetch $dept from php file below and display it in a widget or store the data in Flutter: Future _saveCheckIn() Thanks in advance. Answer You can

Response to json Payload in POST API not in Json Format

I have a Rest API that accepts a Json Payload, i format the Data and import this into the SQL Database. However when the payload is received the sender is waiting for a response. They do not want a Typical HTTP 200 OK, they want a formatted Json Response with the Price etc for the submission. Whenever i output the

Get empty result api firebase [FCM]

I’ve saved some of my mobile registration_codes that are connected with my development environment of Firebase. Once I send a manual notification by the api I receive empty feedback from Firebase himself. After debugging I found that the notification has not been send. What’s wrong with my call, because the call I make is the same in the examples and

Retrieve data from the name of a directory in my database

I use php and laravel. I have a column named MsgBody. In this column, there is an array as follows. I want to get the value of “conversationDesc” from this array. What should I do in the Controller and blade part for this? Answer It seems that your data are JSON. You can decode this using json_decode. You should be

Invalid JSON path expression. The error is around character position

I insert json data to mySql database like this: Now, I try to update social-enable value using JSON_REPLACED method like this: In action I see this error: How do can I fix this problem? Answer JSON Path Syntax … Names of keys must be double-quoted strings or valid ECMAScript identifiers (see Identifier Names and Identifiers, in the ECMAScript Language Specification).

PHP equivalent of javascript JSON.stringify()

As I notice PHP’s json_encode($array) mess things up on diacritics. If I update my database column type text with javascript-created JSON passed over HTTP, everything looks good. but when I create the JSON into PHP, some characters get encoded weirdly. I have this array; Answer First off, it’s worth pointing out that PHP is not “messing up” anything. It’s escaping