{"id":16810507,"url":"https://github.com/mrhwick/partialmarshal","last_synced_at":"2026-07-03T04:02:13.257Z","repository":{"id":57610103,"uuid":"107575374","full_name":"mrhwick/partialmarshal","owner":"mrhwick","description":"A Go library for JSON marshaling  with extra payloads","archived":false,"fork":false,"pushed_at":"2018-07-19T18:47:27.000Z","size":150,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-10-30T23:47:08.395Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrhwick.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-19T17:04:05.000Z","updated_at":"2022-12-23T03:54:27.000Z","dependencies_parsed_at":"2022-09-26T20:00:56.901Z","dependency_job_id":null,"html_url":"https://github.com/mrhwick/partialmarshal","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mrhwick/partialmarshal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhwick%2Fpartialmarshal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhwick%2Fpartialmarshal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhwick%2Fpartialmarshal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhwick%2Fpartialmarshal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrhwick","download_url":"https://codeload.github.com/mrhwick/partialmarshal/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhwick%2Fpartialmarshal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28329779,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:13:06.322Z","status":"ssl_error","status_checked_at":"2026-01-12T00:04:50.725Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T10:15:40.542Z","updated_at":"2026-01-12T00:26:59.073Z","avatar_url":"https://github.com/mrhwick.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PartialMarshal [![GoDoc](https://godoc.org/github.com/mrhwick/partialmarshal?status.svg)](https://godoc.org/github.com/mrhwick/partialmarshal) [![Build Status](https://travis-ci.org/mrhwick/partialmarshal.svg?branch=master)](https://travis-ci.org/mrhwick/partialmarshal) [![Go Report Card](https://goreportcard.com/badge/github.com/mrhwick/partialmarshal)](https://goreportcard.com/report/github.com/mrhwick/partialmarshal)\n\nA Go library for JSON marshaling  with extra payloads.\n\nStandard Go JSON marshaling into a struct discards any unmatching fields from the JSON payload. In some use cases, the developer does not want to discard this extra payload data. This library provides a familiar interface for performing marshaling and unmarshaling while keeping any extra data for use by the calling code.\n\n## Install\n\n```bash\ngo get github.com/mrhwick/partialmarshal\n```\n\n## Usage and Examples\n\nJust like the standard library `json` package, `partialmarshal` provides a simple pair of functions for marshaling and unmarshaling of JSON-formatted data into and out of structs.\n\nWhen a user wants to use partialmarshal to hold onto extra data from a JSON payload, they may simply add the `partialmarshal.Extra` type as an embedded type in their struct. This embedded type is used by the partialmarshal library for storage of any data from the provided JSON that doesn't match a field of that struct.\n\n```go\ntype Person struct {\n\tName string\n\tFavoriteFood string `json:\"favorite_food\"`\n\tpartialmarshal.Extra\n}\n\njsonData := []bytes(`{\"name\": \"gopher\", \"favorite_food\": \"Pizza\", \"age\": 25}`)\n```\n\n```go\n// Unmarshaling\n// =\u003e Person{Name: \"gopher\", FavoriteFood: \"Pizza\", partialmarshal.Extra{\"age\":25}}\nvar p Person\npartialmarshal.Unmarshal(jsonData, \u0026p)\n\n// Marshaling\n// =\u003e `{\"name\": \"gopher\", \"favorite_food\": \"Salad\", \"age\" 25}`\np.FavoriteFood = \"Salad\"\nresult, err := partialmarshal.Marshal(p)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrhwick%2Fpartialmarshal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrhwick%2Fpartialmarshal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrhwick%2Fpartialmarshal/lists"}