Stark9837, to python
@Stark9837@techhub.social avatar

How would you feel about a to introduce Paths to ?

When using a dictionary:

MyDict = { "key1": "value1", "key2": { "key3": "value3" } }
Normally, to access "value3," you would need:

MyDict["key2"]["key3"] or MyDict.get("key2").get("key3")

And that is if you are 100%, the key does exists, otherwise you need to have a default value in order to have the second get not to fail:

MyDict.get("key2", {}).get("key3")

If we could use Json paths, we could simply use:

MyDict["$.key2.key3"]

Example of a library:

Glom

@Python

anderseknert, to golang
@anderseknert@hachyderm.io avatar

Anyone hacking #golang code aware of any #JSON marshaller implementation that will let me have any say in what's "pretty"? The default one is waaay to spacious for anything but the most simple of objects. I can't believe I'm coming up with nothing searching for this. Kinda hoping it's just me being a boomer with no idea about how to use the internet? Please say it's so.

adamsdesk, (edited ) to random
@adamsdesk@fosstodon.org avatar

How To Count JSON Array Elements with Jq

Learn by example on how to count JSON array elements with the use of the powerful open source lightweight command-line program, jq.

https://www.adamsdesk.com/posts/count-json-array-elements-jq/

#commandline #json #api #development

fell, (edited ) to gamedevelopment
@fell@ma.fellr.net avatar

"Use GLTF for your 3D assets. It's based on JSON. And JSON is great!" they said.

Well, I regret to inform you that the majority of the game's asset loading times are parsing JSON.

Yes, decoding meshes, textures and animations and uploading them to the GPU are all faster than parsing the stupid JSON. I hate it.

ivan18rod, to fediverse

Oof, I'm tapping out. That bug is more like a camouflaged walking stick. I could not find what it is and where it is at.

I still learned about how the protocol works, and I would like to talk about how it can be improved. When looking at a Note object, I noticed that its content property uses as the note's content. Yes, many instances have protections against the inherent risks of an XSS attack, but I'm thinking of a safer way to represent rich text that is meant to be displayed across different platforms.

What if was used instead? JSON is used by the AP protocol to represent other objects and activities, so how could JSON be used for representing UI?

Here's how some rich text could be represented in JSON:

[
  {
    "type": "paragraph",
    "content": [
      {"type": "text", "text": "This is a "},
      {"type": "bold", "content": [{"type": "text", "text": "test"}]},
      {"type": "text", "text": "."}
    ]
  }
]

Here is what the snippet above would generate:> This is a test.

What do you think? Feel free to let me know below.

RE: https://calckey.social/notes/9fj16f4yb13oybi7

cjerrington, to Powershell
@cjerrington@mstdn.social avatar

I need some help with where we need to export some values all as strings. So the numbers we have in the object need to be strings, but only are exported as integers.

Example:
{
"SchemaVersion": 1
}

Needs to be

{
"SchemaVersion": "1"
}

wyri, to random
@wyri@haxim.us avatar

I swear I didn't commit the vendor/node_modules/yarn cache directory! It's just pretty printing #JSON:

annathepiper, to wordpress
@annathepiper@mastodon.murkworks.net avatar

Followup on this thread I posted earlier:

https://mastodon.murkworks.net/@annathepiper/111467755713006541

I have advanced the problem along a bit. My current problem is that in all my various directories of screenshot files, I have a metadata.json file I want to extract data from. I want to use the extracted data to build an appropriate "wp media import" command, to feed to WP-CLI.

Here's my dilemma: I don't know jq well enough yet. I've been trying to teach myself about how its filters work tonight, but I'm not quite comfortable enough with it or with bash to work out how to accomplish what I want to do.

Recommendations solicited. /1

drupalthoughts, to drupal
@drupalthoughts@fosstodon.org avatar

I've been tasked to upgrade another inherited 9 site to 10, apply a some major updates to the existing theme, and stage it on
As-is, none of the contrib modules had been defined in its config, and it has quite a few complex added features and content types that may no longer be required. Let's see how this goes! 😎

brunty, to random
@brunty@brunty.social avatar

Deployed a tool for a personal / #SelfHosted thing recently and it was configured using #XML

There was much rejoicing, no #YAML, no #JSON!

patrick_h_lauke, to random
@patrick_h_lauke@mastodon.social avatar

whenever somebody talks about #json my mind goes to this...

Luke, to RSS
@Luke@typo.social avatar
PaulHammond51, to space
@PaulHammond51@fosstodon.org avatar

Mars: Ingenuity helicopter flight #70 is in the books.

#Ingenuity #Perseverance #Mars2020 #NASA #space #JSON #Data #Mars

meuon, to random
@meuon@fosstodon.org avatar

JSON is usually beautifully simply and useful. I'm starting to see the same un-necessarily over-complicated nesting of simple data by API vendors as the XML crowd. All I'm missing is Base64encoded JSON inside of Base64encoded JSON.

(Used to see that in the XML world)

#JSON

pablolarah, to wordpress
@pablolarah@mastodon.social avatar
louis, (edited ) to webdev
@louis@emacs.ch avatar

To you, what looks like a proper field naming/casing convention in a public JSON data model ?

... so many possibilities ... 🤔​

#webdev #programming #json

rysiek, to random
@rysiek@mstdn.social avatar

If you're implementing DNS-over-HTTP JSON client and wondering what Accept header media type to use… 👀

There's RFC8427, "Representing DNS Messages in JSON"; it defines the JSON structure. You can ignore it. No DoH JSON API provider I tested implements it.

It also defines the application/dns+json media type, registered with IANA. You can ignore it as well. Only CloudFlare cares about the media type — and insists on application/dns-json (yes, with a "-"). 🙄

#DNS #DoH #JSON #FuckCloudFlare

antolius, to fediverse

So, I looked into ActivityPub the other day. I wanted to play around with it, maybe make some small project.

It quickly turned into a rabbit hole of specifications with -LD →

It is at this point that I noticed a lack of native supported for IRI in JVM languages. "Up the spec chain" situation was spotty; I found a couple of libs implementing parts of it. But lacking a standard representation of basic concept such as links seemed troublesome.

notsle, to random
@notsle@kzoo.to avatar

Isn't it fun when an API returns JSON, when there is one result, the data is a object, but if its multiple, its an array of objects. But only some calls, on other calls its always an array.

So much for consistancy.

#development #json #restapi

paulox, to django
@paulox@fosstodon.org avatar

I found my first bug in Django 5.0 after the feature freeze 🐛

It's related to GeneratedField and JSONField and maybe you can help to fix it 👇
https://code.djangoproject.com/ticket/34861

#django #django5 #bug #generatedfield #jsonfield #json #sql #orm #migrations

clonezone, to random

jless is so friggin' useful: https://jless.io/

EvanHahn, to python

Just learned that #Python can produce nonstandard #JSON values if passed infinity or NaN. More details here: https://evanhahn.com/pythons-nonstandard-json-encoding/

steve, to fediverse
@steve@social.technoetic.com avatar

For the JSON-LD experts out there... does the Compaction algorithm ever produce a document with a null property value in the document body? I know that a null-valued property is treated as if it doesn't exist, but I can't identify the step in the Compaction algo where they are removed (given a null in the pre-compacted document). JSON-LD Playground removes the nulls, but I don't know if this is the normative behavior for all processors or not. -ld

jmcastagnetto, to random
@jmcastagnetto@mastodon.social avatar

@coolbutuseless -- just saw this on the incognito site :-)

https://x.com/JosiahParry/status/1787871177677115698

{yyjsonr} rewlz in speed and size

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • thenastyranch
  • magazineikmin
  • mdbf
  • GTA5RPClips
  • everett
  • rosin
  • Youngstown
  • tacticalgear
  • slotface
  • ngwrru68w68
  • kavyap
  • DreamBathrooms
  • khanakhh
  • megavids
  • tester
  • ethstaker
  • cubers
  • osvaldo12
  • cisconetworking
  • Durango
  • InstantRegret
  • normalnudes
  • Leos
  • modclub
  • anitta
  • provamag3
  • lostlight
  • All magazines