Questions tagged [jsonencoder]

Use this tag for `JSONEncoder` questions on Apple platforms.

JSONEncoder is a class, introduced in Swift 4, for encoding types on Apple operating systems that conform to Encodable protocol (or Codable protocol, which is type alias for Encodable & Decodable). This offers a simple mechanism to easily generate JSON from Encodable Swift types. This applies to standard Swift collections, such as Array and Dictionary, but custom types can conform to Encodable to participate in this simplified JSON encoding process.

This replaces/supplements the JSONSerialiation class used in prior Swift versions.

See also:

125 questions
-2
votes
1 answer

Root name and child name for json format using json_encode in php

I'm having some issues with json_encode, i need that the output were something like this: { "Advisories": [ { "Advisory": { "Severe": "false", "description": "Lorem ipsum dolor sit amet", "title": "Advise:", …
skycomputer2
  • 243
  • 1
  • 13
-2
votes
1 answer

JSONEncoder().encode is always empty

I have a class that it has the next import UIKit final class PruebaModel: Codable { let a: String? let b: String? let c: [D]? let f: String? enum CodingKeys: String, CodingKey { case a = "a" case b…
Alejandro Gonzalez
  • 1,221
  • 4
  • 15
  • 30
-2
votes
1 answer

How to JSON encode a user array using PHP?

Im working with a JSON file that checks, if a user is typing. Is there any reason why this would not work? // Array of WP_User objects. foreach ( $user_query as $user ) { $result['whotyping'] = $user_info->whotyping; …
Mic
  • 331
  • 1
  • 2
  • 14
-2
votes
1 answer

PHP JSON_ENCODE Process Gets Aborted by ESCAPE key

My web page uses bootstrap and jquery, and during a rather long page load, which reads some PHP session variables with JSON_ENCODE, pressing the ESCAPE key seems to stop the process, aborting the read, and causing the page load to fail. This occurs…
iSofia
  • 1,412
  • 2
  • 19
  • 36
-3
votes
1 answer

I want to console.log value of var_dump of array. How do I do that?

It works fine it returns me an json object after all if I write like this. public function getElementsAction() { $currency = App::$app->getProperty('currency'); if(!empty($_POST)) { $sql = 'SELECT name, price, file, time FROM…
1 2 3
8
9