Marshalling nested json objects on GO lang
I have a struct type MyStruct struct { A string B int C string D int } And I want to convert it into a json object like this: { "A": "Some string", "B": 1234, "otherStruct": { "C": "Other string",…
I have a struct type MyStruct struct { A string B int C string D int } And I want to convert it into a json object like this: { "A": "Some string", "B": 1234, "otherStruct": { "C": "Other string",…
I have this JSON: { "mainObjeto": { "id": 1, "descripcion": "some text", "reclamoMotivo": { "id": 3, "nombre": "yyyyy", "descripcion": "Producto con Defectos" }, "empresa": { "id": 1, "nombreEmpresa": "xxxx", "descripcionEmpresa": "xxxx" }, "adjuntos": [ { "id": 1, "nombreAdjunto": "test.txt" },…
Below is the default code to parse a JsonArray, which works totally fine if there is of course no error or typo in the Json string: public class Person { public int Id { get; set; } public required string…
I have an array of 5 elements out of which I want to compare index position 1 and 2 and keep 1 or 2 based on weather it is an integer. Retain other elements as it is. Scenario below: if…
I have a JSON file to be imported into R. Here is a section of the data: {"data":[{"British Columbia":"BC","BC":"4.63"}, {"Alberta":"AB","AB":"4.15"}, {"Ontario":"ON","ON":"13.6"}]} I need to turn this data into a dataframe, but the import is producing many NA values. I tried…
I have a bit of a thorny JSON manipulation problem. I have half a mind to just write a Python program to do it, but I’m wondering if a well-written jq query can solve it more elegantly — partly for…
I'm using System.Text.Json. I have the following models: public class Contacts { [JsonPropertyName("id")] public long Id { get; set; } [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; [JsonPropertyName("paused")] public bool Paused { get; set; } [JsonPropertyName("type")] public…
This is the command I use to pull the info I need: .results | .[] | {id, name: .general.name, platform: .general.platform, site: .general.site.name, ea_site: .extensionAttributes.[] | select(.definitionId=="57").values.[]} When .extensionAttributes.[] | select(.definitionId=="57").values.[] is empty, jq does not display any associated items…
I have a base schema and extended schema below ./resources/json-schemas/simple-person.schema { "$id": "http://example.com/json-schemas/simple-person.schema", "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Simple Person", "type": "object", "people": { "items": { "properties": { "name": { "type": "string", "description": "The person's name." }, "age": { "type": "integer", "description":…
ish at XSLT and have a XSLT output that contains some json within elements. I've been looking around to see if there is anyway for XSLT to replace the json with just a string: Ex: <company:Cause xmlns:company="http://example.com/company" xmlns:j="http://example.com/j" xmlns:s="http://example.com/s" xmlns:nc="http://example.com/nc"…