Questions marquées «json»

JSON (JavaScript Object Notation) est un format d'échange de données textuel et indépendant de la langue. Utilisez cette balise lorsque ce format de texte est impliqué. N'UTILISEZ PAS CETTE ÉTIQUETTE POUR LES OBJETS NATIFS JAVASCRIPT OU LES OBJETS JAVASCRIPT LITERALS. Avant de poser une question, validez votre JSON à l'aide d'un validateur JSON tel que JSONLint (https://jsonlint.com).

16
TypeError: ObjectId ('') n'est pas sérialisable JSON
Ma réponse de MongoDB après avoir interrogé une fonction agrégée sur un document en utilisant Python, elle renvoie une réponse valide et je peux l'imprimer mais je ne peux pas la renvoyer. Erreur: TypeError: ObjectId('51948e86c25f4b1d1c0d303c') is not JSON serializable Impression: {'result': [{'_id': ObjectId('51948e86c25f4b1d1c0d303c'), 'api_calls_with_key': 4, 'api_calls_per_day': 0.375, 'api_calls_total': 6, 'api_calls_without_key': …
111 python  json  mongodb  flask 


4
Utilisation de GSON pour analyser un tableau JSON
J'ai un fichier JSON comme celui-ci: [ { "number": "3", "title": "hello_world", }, { "number": "2", "title": "hello_world", } ] Avant, lorsque les fichiers avaient un élément racine, j'utilisais: Wrapper w = gson.fromJson(JSONSTRING, Wrapper.class); code mais je ne peux pas penser comment coder la Wrapperclasse car l'élément racine est un …
110 java  arrays  json  gson 



3
Objets JSON imbriqués - dois-je utiliser des tableaux pour tout?
Existe-t-il un moyen d'avoir des objets imbriqués dans JSON pour ne pas avoir à créer des tableaux à partir de tout? Pour que mon objet soit analysé sans erreur, il me semble avoir besoin d'une structure comme celle-ci: {"data":[{"stuff":[ {"onetype":[ {"id":1,"name":"John Doe"}, {"id":2,"name":"Don Joeh"} ]}, {"othertype":[ {"id":2,"company":"ACME"} ]}] },{"otherstuff":[ {"thing": …

1
curl json post demande via un terminal vers une application de rails
J'essaie de créer un utilisateur sur mon application rails avec une commande curl du terminal os x. Quelle que soit la façon dont je formate les données, l'application renvoie une réponse que aucune de mes validations n'a réussi. curl http://localhost:3000/api/1/users.json -i -X POST -d {"user":{"first_name":"firstname","last_name":"lastname","email":"email@email.com","password":"app123","password_confirmation":"app123"}}" J'ai essayé toutes les variantes. …

14
La conversion la plus efficace de ResultSet en JSON?
Le code suivant convertit a ResultSeten chaîne JSON à l'aide de JSONArrayet JSONObject. import org.json.JSONArray; import org.json.JSONObject; import org.json.JSONException; import java.sql.SQLException; import java.sql.ResultSet; import java.sql.ResultSetMetaData; public class ResultSetConverter { public static JSONArray convert( ResultSet rs ) throws SQLException, JSONException { JSONArray json = new JSONArray(); ResultSetMetaData rsmd = rs.getMetaData(); while(rs.next()) …
109 java  sql  json  resultset 


8
Pourquoi lorsqu'un constructeur est annoté avec @JsonCreator, ses arguments doivent être annotés avec @JsonProperty?
Dans Jackson, lorsque vous annotez un constructeur avec @JsonCreator, vous devez annoter ses arguments avec @JsonProperty. Donc ce constructeur public Point(double x, double y) { this.x = x; this.y = y; } devient ceci: @JsonCreator public Point(@JsonProperty("x") double x, @JsonProperty("y") double y) { this.x = x; this.y = y; } …

6
Comment modifier JsonNode en Java?
J'ai besoin de changer la valeur d'un attribut JSON en Java, je peux obtenir la valeur correctement mais je n'ai pas pu modifier le JSON. voici le code ci-dessous JsonNode blablas = mapper.readTree(parser).get("blablas"); for (JsonNode jsonNode : blablas) { String elementId = jsonNode.get("element").asText(); String value = jsonNode.get("value").asText(); if (StringUtils.equalsIgnoreCase(elementId, "blabla")) …
109 java  json  jackson 


13
Pourquoi json_encode retournerait-il une chaîne vide
J'ai une structure php simple avec 3 tableaux imbriqués. Je n'utilise pas d'objets particuliers et je construis moi-même les tableaux avec 2 boucles imbriquées. Voici un exemple du var_dump du tableau que je souhaite convertir en Json. array (size=2) 'tram B' => array (size=2) 0 => array (size=3) 'name' => …
108 php  json 

7
json_encode / json_decode - renvoie stdClass au lieu de Array en PHP
Observez ce petit script: $array = array('stuff' => 'things'); print_r($array); //prints - Array ( [stuff] => things ) $arrayEncoded = json_encode($array); echo $arrayEncoded . "<br />"; //prints - {"stuff":"things"} $arrayDecoded = json_decode($arrayEncoded); print_r($arrayDecoded); //prints - stdClass Object ( [stuff] => things ) Pourquoi PHP transforme-t-il l'objet JSON en classe? Un …
108 php  json 

4
Obtenez des informations ffmpeg de manière conviviale
Chaque fois que j'essaie d'obtenir des informations sur mes fichiers vidéo avec ffmpeg, cela dégage beaucoup d'informations inutiles mélangées à de bonnes choses. J'utilise ffmpeg -i name_of_the_video.mpg. Y a-t-il des possibilités d'obtenir cela de manière amicale? Je veux dire que JSON serait génial (et même XML laid est bien). À …
108 json  parsing  ffmpeg 

En utilisant notre site, vous reconnaissez avoir lu et compris notre politique liée aux cookies et notre politique de confidentialité.
Licensed under cc by-sa 3.0 with attribution required.