Implementation
Rust

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating resource.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
import "encoding/json"
import "io/ioutil"
buffer, err := ioutil.ReadFile("data.json")
if err != nil {
	return err
}
err = json.Unmarshal(buffer, &x)
if err != nil {
	return err
}
use File::Slurp;
use JSON;
my $str = read_file('data.json');
my $x = decode_json($str);
import json
with open("data.json", "r") as input:
    x = json.load(input)
import std.file: readText;
import std.json: parseJSon;
JSONValue x = "data.json".readText.parseJSON;

struct User {
    int age;
    string name;

    this(JSONValue user) {
        age  = user["age"];
        name = user["name"];
    }
}

auto user = User(x);
import 'dart:io' show File;
import 'dart:convert' show json;
Map x = json.jsonDecode(await new File('data.json').readAsString());
require 'json'
x = JSON.parse(File.read('data.json'))
$x = json_decode(file_get_contents('data.json'));
import "encoding/json"
r, err := os.Open(filename)
if err != nil {
	return err
}
decoder := json.NewDecoder(r)
err = decoder.Decode(&x)
if err != nil {
	return err
}