Questions tagged [decode]

In order to transform certain coded information (such as bytes or electric signals) into a format suitable for additional analysis (like text, an entity, or an image).

Deciphering complex JSON structures in PHP

I've come across a JSON structure that I need to parse. While I have managed to extract individual nested objects, it feels like there should be a simpler way to achieve this without having to search for each nested structure. Here is an example of the JS ...

PHP code for converting hex codes into characters

Some instances include: x2f x3f x253d Is there a way in PHP to convert these special characters? I have looked but can't find any solutions. Appreciate your help! ...

Deciphering GB2312 encoding with PHP

Currently, I am developing an IMAP email script and have encountered some lines of code in GB2312 (which seems to be Chinese encoding). The code format looks like this: =?GB2312?B?foobarbazetc I am curious about how I can begin working with this string. A ...

Working with a list in Json.Decode.Pipeline in Elm version 0.18

Within my code, I have a type alias that includes a nested list. I am looking to use Json.Decode.Pipeline to parse this data structure. import Json.Decode as Decode exposing (..) import Json.Encode as Encode exposing (..) import Json.Decode.Pipeline as Pi ...

Access specific data within a JSON array in PHP without the need for a foreach loop

Lately, I've been facing some challenges when it comes to decoding and interpreting the prices for specific items in the bitskins api. For instance, the OPSKINS API provides a straightforward output: {"status":1,"time":1477116462,"response":{"AK-47 ...

Swift4 JSON Parsing Tool

Looking to convert a JSON file into a Codable struct in Swift4 for iOS11.1 and Xcode9.1, Below is my code: struct Station: Codable { let htmlAttributions: [String] let nextPageToken: String let status: String struct Result: Codable { ...

php When using json_decode with the boolean value true

Upon receiving data from an API, I am dealing with a Json array. $json_array = curl_exec($curl); var_dump($json_array); echo '<br>'.mb_detect_encoding($json_array);` {"code":"TEXT","name":"/generic/PRODUCT",&q ...

Can you explain the distinction between using json_encode($response, JSON_FORCE_OBJECT) versus just json_encode($response)?

What is the difference in output between the two JSON encoding methods in PHP? Can someone provide guidance on the decoding options for each? json_encode($response, JSON_FORCE_OBJECT); json_encode($response); ...

Unlocking JSON with various structures using Swift

I am dealing with json data that follows a consistent structure from a nosql database (PK, SK, attributes). The content of the attributes section varies depending on the value of SK. For instance: [ { "PK": "POLL#1544693DF0E88EC-3225- ...

Converting a decimal Unicode to a string in Javascript/Node: a beginner's guide

In my database, I have Arabic sentences that contain decimal unicodes for quotation marks and other elements. For example, here is a sample text: "كريم نجار: تداعيات &#8220;كورونا&#8221; ستغير مستقبل سوق السي ...

What is the process for decoding data into an embedded struct?

Is there a way to utilize .Decode() on a response body to populate a struct without needing to determine the specific type of struct beforehand? I have a versatile struct called Match, designed to store information about various games, like a match in For ...

Unravel various models in PHP Symfony by decoding JSON data into objects

Is there a way to effectively convert a multidimensional JSON into an object or model? When attempting to convert a JSON with nested structures, only the outer layer is successfully converted while inner layers remain as arrays. How can this issue be reso ...

Leverage decodable for personalized JSON parsing

I possess a json in this particular structure: { "route":{ "1":"Natural Attractiveness", "2":"Cultural Attractiveness", "3":"For Families with Children", "5":"For Seniors", "6":"For Eagles", "8":"Disabled" }, ...

Decoding JSON data from a URL on the Arduino IDE using ESP8266

My process involves programming the esp8266 using the Arduino IDE and connecting to a local network via WIFI. The goal is to download JSON content generated on the local server, with the following code being used: #include <ESP8266WiFi.h> #incl ...

How can text be encoded or decoded using a key in PHP?

Snippet: $encryptedData = mcrypt_ecb (MCRYPT_3DES, 'test', $originalData, MCRYPT_ENCRYPT); The above code encrypts $originalData. How can we decrypt $encryptedData? Please advise on how to decrypt the variable $encryptedData. ? ...

Exploring and sifting through JSON data in PHP

Can someone assist me with parsing and navigating through JSON results using PHP? In the example below, I need to specifically target technology categories. What I want to achieve is to identify if the category 'analytics' exists in the result, set a true ...

Is there a way to retrieve the name associated with the ID or organize them in a specific order?

I have encountered a major issue for which I am unable to find a solution. The problem at hand is related to retrieving the name of a hero using their ID from a JSON object returned by an API. [ { "id":0, "name":"N/A" }, { "id":1, "name":"John" }, { "id" ...

Unravel JSON using JavaScript on the web

I encountered an issue while running this code and trying to decode it: var data = JSON.parse({"forms":[{"url":"example.com/example","name":"example"}]}) document.getElementById("name").innerHTML=data.forms.name Instead of the expected value, the returne ...

Struggling to convert JSON data into a variable, but all I'm getting is a null response

I am facing an issue where I am attempting to convert a JSON file into a PHP variable, but the result is that the PHP variable ends up being null. Here is the PHP code I have written: $heroes['names'] = json_decode(file_get_contents("file://D:/Xampp/htdoc ...

Uncover the hidden message in a string encoded for JavaScript

This encoded HTML code is intended for use in a JavaScript function <div class="ProductDetail"><div style="width:780px"> <div class="baslik" style="margin: 0px; padding: 5px 10px; border-width: 5px 0px 1px; border-top-style: sol ...