Skip to main content

Questions tagged [jsonencode]

The tag has no usage guidance.

-1 votes
2 answers
51 views

Is there a way to prevent echo json_encode() return the JSON response with the whole page when submitting form to the same PHP script? [duplicate]

I've got this only index.php file in the project. I know I should separate the logic from the view, use different files for PHP, JS and HTML. This is only a test: <?php if($_SERVER["...
Developer's user avatar
  • 107
0 votes
1 answer
285 views

getting error status code 500 from the jsonencode in flutter

onPressed: () async { final url = Uri.parse('https://anash-visual-qa.hf.space/run/predict'); final response = await http.post( url, headers: {'Content-Type':...
dhyanmohan's user avatar
0 votes
0 answers
961 views

JsonUnsupportedObjectError (Converting object to an encodable object failed Error in flutter

I am facing problem while trying to encode Json data to a List of String CartRepo.dart <pre> <code> <pre> <code> import 'dart:convert'; import 'package:ecommerceapp/models/...
Sahil Tiwade's user avatar
0 votes
1 answer
63 views

Use of JSON_EXTRACT() in a loop – Return Data from a JSON Document in MySQL

I try to use the JSON_EXTRACT() function, on my request I have to loop on the "item" object (attention not "items" which is present several times in the JSON file) : { "...
athanar's user avatar
1 vote
2 answers
455 views

How to make json keys as a special order in Swift JSONEncoder?

I need make a request to a server of an open API. The rule of the open API asked json parameter must make keys as a special order(not the A-Z order nor Z-A order). struct Req : Encodable { let ...
boybeak's user avatar
  • 469
0 votes
0 answers
11 views

Json_encode failing on special chars and array_map throws 500 error [duplicate]

I've got a simple bit of php that is reading data from a SQL db and json encoding the rows and echoing it out. It works a treat until any of the columns contain any special chars; then the output is ...
John's user avatar
  • 775
0 votes
1 answer
283 views

Controlling the number of significant digits used by jsonencode

I'd like to use jsonencode in Matlab R2022a to encode a structure containing double precision values, like e.g.: >> s = struct('a', sqrt(2)) s = struct with fields: a: 1.4142 >> ...
Ratbert's user avatar
  • 5,171
0 votes
1 answer
45 views

Transform a multidimensional array from PDO to two simple arrays for a chart [duplicate]

I have a MariaDB with articles and each article has a date. I want to display a bar chart with number of articles per date. I get the data with this code: $statement = $pdo->prepare( " SELECT ...
mars's user avatar
  • 40
-2 votes
2 answers
92 views

Create json-encoded array from a PDO query result column

I am creating a json array with data from mysql: $array = $db->query("SELECT ...")->fetchAll(PDO::FETCH_ASSOC); print json_encode($array); This returns: [{"animal":"...
TheG's user avatar
  • 19