Code Explainers
Code explainers tagged #json
ruby
require "base64" require "json" module Attachment
Packing binary attachments into JSON
serialization
base64
json
Intermediate
8 steps
rust
use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize)] pub struct UserProfile {
Trimming JSON output with serde attributes
serialization
json
attributes
Intermediate
8 steps
go
package handlers import ( "encoding/json"
Hardening JSON decoding in Go HTTP handlers
json
error-handling
http
Intermediate
8 steps
go
package api import ( "encoding/json"
Building reusable JSON helpers in Go HTTP handlers
http
json
error-handling
Intermediate
9 steps
rust
use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize)] #[serde(tag = "type", rename_all = "snake_case")]
Tagged enums with serde in Rust
enums
serialization
json
Intermediate
6 steps
python
from datetime import datetime, date from decimal import Decimal from flask import Flask, jsonify from flask.json.provider import DefaultJSONProvider
Serializing SQLAlchemy models in Flask JSON
serialization
orm
json
Intermediate
6 steps
php
<?php function uploadDocument(string $endpoint, string $filePath, array $meta): array {
Uploading a file with cURL in PHP
curl
file-upload
http
Intermediate
8 steps
python
import json from dataclasses import dataclass, field, asdict from datetime import datetime from typing import Any
JSON round-tripping with Python dataclasses
dataclasses
serialization
json
Intermediate
6 steps
go
package feed import ( "encoding/json"
Streaming a JSON array in Go
streaming
json
decoder
Intermediate
6 steps
java
public class OrderSerializer { private final ObjectMapper mapper;
Configuring a reusable Jackson ObjectMapper
serialization
json
builder-pattern
Intermediate
8 steps
rust
use serde::Deserialize; use serde_json::Value; use std::collections::HashMap;
Modeling nested JSON with serde in Rust
deserialization
json
struct-mapping
Intermediate
9 steps
rust
use axum::{ http::StatusCode, response::IntoResponse, routing::get,
Serving an SPA and API with Axum
routing
static-files
spa-fallback
Intermediate
7 steps
go
package model import ( "encoding/json"
Custom JSON marshaling in Go
json
serialization
interfaces
Intermediate
5 steps