Title: Problem Serialising Array / Enumerable. · Issue #101 · JSONAPIdotNET/JSONAPI.NET · GitHub
Open Graph Title: Problem Serialising Array / Enumerable. · Issue #101 · JSONAPIdotNET/JSONAPI.NET
X Title: Problem Serialising Array / Enumerable. · Issue #101 · JSONAPIdotNET/JSONAPI.NET
Description: Version - 0.2.0.0 (nuget) When serialising an array or enumerable, I get the following formatted output: { "products":{ "id":"NOIDCOMPUTABLE!", "length":3, "longLength":3, "rank":1, "isReadOnly":false, "isFixedSize":true, "isSynchronized...
Open Graph Description: Version - 0.2.0.0 (nuget) When serialising an array or enumerable, I get the following formatted output: { "products":{ "id":"NOIDCOMPUTABLE!", "length":3, "longLength":3, "rank":1, "isReadOnly":fa...
X Description: Version - 0.2.0.0 (nuget) When serialising an array or enumerable, I get the following formatted output: { "products":{ "id":"NOIDCOMPUTABLE!", "length":3, &...
Opengraph URL: https://github.com/JSONAPIdotNET/JSONAPI.NET/issues/101
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Problem Serialising Array / Enumerable.","articleBody":"Version - 0.2.0.0 (nuget)\n\nWhen serialising an array or enumerable, I get the following formatted output:\n\n``` json\n{\n \"products\":{\n \"id\":\"NOIDCOMPUTABLE!\",\n \"length\":3,\n \"longLength\":3,\n \"rank\":1,\n \"isReadOnly\":false,\n \"isFixedSize\":true,\n \"isSynchronized\":false,\n \"links\":{\n \"syncRoot\":\"NOIDCOMPUTABLE!\"\n }\n }\n```\n\nThe class being serialised is:\n\n``` csharp\n[JsonObject(Title = \"product\")]\n public class ProductDto\n {\n public int Id { get; private set; }\n public string Name { get; private set; }\n\n public ProductDto(int id, string name)\n {\n Id = id;\n Name = name;\n }\n\n public override string ToString()\n {\n return string.Format(\"ProductDto [Id: {0}, Name: {1}]\", Id, Name);\n }\n }\n```\n\nIf I serialise one of these (instead of an array) I get the expected output:\n\n``` json\n{\"products\":{\"id\":\"1\",\"name\":\"bob\"}}\n```\n\nThis is running in a Web Api 2 project, with the following setup code in `WebApiConfig.cs`:\n\n``` csharp\nusing JSONAPI.EntityFramework; // For pluralisation service.\nusing JSONAPI.Json;\n// ...\nvar formatter = new JsonApiFormatter { PluralizationService = new PluralizationService() };\nconfig.Formatters.Add(formatter);\n```\n\nIs there anything I am missing here? I've searched other open issues (and Stackoverflow) but couldn't see this mentioned anywhere.\n\nThanks.\n","author":{"url":"https://github.com/robert-af","@type":"Person","name":"robert-af"},"datePublished":"2015-09-03T08:51:42.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/101/JSONAPI.NET/issues/101"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2f532a77-5fdc-e9a0-e5eb-0170e12fc36e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A6C6:188FE8:5514F01:7810B60:6A4FF5D7 |
| html-safe-nonce | a8afd8d03be52182af14169bfcf969c3baaaecd3dbc8a629a326b99f03fefd77 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNkM2OjE4OEZFODo1NTE0RjAxOjc4MTBCNjA6NkE0RkY1RDciLCJ2aXNpdG9yX2lkIjoiMzk3OTQwOTgzNTcyODgyNzg2MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 13b34ada2952869ffbd7fc8a60b5a7be0b4abd9a5e6d93c8826b62b5d4028327 |
| hovercard-subject-tag | issue:104649435 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/JSONAPIdotNET/JSONAPI.NET/101/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c9dfbe421af6f754c93d74137b84f6e9d7b4871d2845568328d0ec3c2812a39f/JSONAPIdotNET/JSONAPI.NET/issues/101 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c9dfbe421af6f754c93d74137b84f6e9d7b4871d2845568328d0ec3c2812a39f/JSONAPIdotNET/JSONAPI.NET/issues/101 |
| og:image:alt | Version - 0.2.0.0 (nuget) When serialising an array or enumerable, I get the following formatted output: { "products":{ "id":"NOIDCOMPUTABLE!", "length":3, "longLength":3, "rank":1, "isReadOnly":fa... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | robert-af |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3bd0ff5d28a87b4801a63fb38c2a21a91b0a700dca159dc9416aeae05771b899 |
| turbo-cache-control | no-preview |
| go-import | github.com/JSONAPIdotNET/JSONAPI.NET git https://github.com/JSONAPIdotNET/JSONAPI.NET.git |
| octolytics-dimension-user_id | 16112275 |
| octolytics-dimension-user_login | JSONAPIdotNET |
| octolytics-dimension-repository_id | 27474358 |
| octolytics-dimension-repository_nwo | JSONAPIdotNET/JSONAPI.NET |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27474358 |
| octolytics-dimension-repository_network_root_nwo | JSONAPIdotNET/JSONAPI.NET |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 67a336083e4dcb40224dc2c01cd4c7ed413bdb09 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width