{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/docfx/pulls/comments/49963101","id":49963101,"diff_hunk":"@@ -0,0 +1,107 @@\n+// Copyright (c) Microsoft. All rights reserved.\n+// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n+\n+namespace Microsoft.DocAsCode.EntityModel\n+{\n+    using System;\n+    using System.IO;\n+    using System.Threading;\n+\n+    using Jint;\n+\n+    using Microsoft.DocAsCode.Common;\n+\n+    using Newtonsoft.Json;\n+    using Newtonsoft.Json.Linq;\n+\n+    public class JintProcessorHelper\n+    {\n+        private static readonly ThreadLocal<JsonSerializer> _toJsValueSerializer = new ThreadLocal<JsonSerializer>(\n+            () =>\n+            {\n+                var jsonSerializer = new JsonSerializer();\n+                jsonSerializer.NullValueHandling = NullValueHandling.Ignore;\n+                jsonSerializer.ReferenceLoopHandling = ReferenceLoopHandling.Serialize;\n+                jsonSerializer.Converters.Add(new JObjectToJsValueConverter());\n+                return jsonSerializer;\n+            });\n+\n+        public static Jint.Native.JsValue ConvertStrongTypeToJsValue(object raw)\n+        {\n+            using (MemoryStream ms = new MemoryStream())\n+            {\n+                using (StreamWriter sw = new StreamWriter(ms))\n+                {\n+                    JsonUtility.Serialize(sw, raw);\n+                    sw.Flush();\n+                    ms.Seek(0, SeekOrigin.Begin);\n+                    using (StreamReader sr = new StreamReader(ms))\n+                    {\n+                        return JsonUtility.Deserialize<Jint.Native.JsValue>(sr, _toJsValueSerializer.Value);\n+                    }\n+                }\n+            }\n+        }\n+\n+        private sealed class JObjectToJsValueConverter : JsonConverter\n+        {\n+            private static readonly Engine DefaultEngine = new Engine();\n+            public override bool CanConvert(Type objectType)\n+            {\n+                return objectType == typeof(Jint.Native.JsValue);\n+            }\n+\n+            public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)\n+            {\n+                if (reader.TokenType == JsonToken.StartArray)\n+                {\n+                    var jArray = JArray.Load(reader);\n+                    return ConvertJObjectToJsValue(jArray);\n+                }\n+                else","path":"src/Microsoft.DocAsCode.EntityModel/TemplateManagers/JintProcessorHelper.cs","position":61,"original_position":61,"commit_id":"f17da85880aad731c1677ffe30f63caeeda76a51","original_commit_id":"f17da85880aad731c1677ffe30f63caeeda76a51","user":{"login":"chenkennt","id":8436953,"avatar_url":"https://avatars.githubusercontent.com/u/8436953?v=3","gravatar_id":"","url":"https://api.github.com/users/chenkennt","html_url":"https://github.com/chenkennt","followers_url":"https://api.github.com/users/chenkennt/followers","following_url":"https://api.github.com/users/chenkennt/following{/other_user}","gists_url":"https://api.github.com/users/chenkennt/gists{/gist_id}","starred_url":"https://api.github.com/users/chenkennt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chenkennt/subscriptions","organizations_url":"https://api.github.com/users/chenkennt/orgs","repos_url":"https://api.github.com/users/chenkennt/repos","events_url":"https://api.github.com/users/chenkennt/events{/privacy}","received_events_url":"https://api.github.com/users/chenkennt/received_events","type":"User","site_admin":false},"body":"Support primitive type?","created_at":"2016-01-18T05:25:36Z","updated_at":"2016-01-18T05:25:36Z","html_url":"https://github.com/dotnet/docfx/pull/126#discussion_r49963101","pull_request_url":"https://api.github.com/repos/dotnet/docfx/pulls/126","_links":{"self":{"href":"https://api.github.com/repos/dotnet/docfx/pulls/comments/49963101"},"html":{"href":"https://github.com/dotnet/docfx/pull/126#discussion_r49963101"},"pull_request":{"href":"https://api.github.com/repos/dotnet/docfx/pulls/126"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/docfx/pulls/126","id":56181141,"html_url":"https://github.com/dotnet/docfx/pull/126","diff_url":"https://github.com/dotnet/docfx/pull/126.diff","patch_url":"https://github.com/dotnet/docfx/pull/126.patch","issue_url":"https://api.github.com/repos/dotnet/docfx/issues/126","number":126,"state":"open","locked":false,"title":"jint jsvalue works, no need to use json.parse as workaround","user":{"login":"vicancy","id":668244,"avatar_url":"https://avatars.githubusercontent.com/u/668244?v=3","gravatar_id":"","url":"https://api.github.com/users/vicancy","html_url":"https://github.com/vicancy","followers_url":"https://api.github.com/users/vicancy/followers","following_url":"https://api.github.com/users/vicancy/following{/other_user}","gists_url":"https://api.github.com/users/vicancy/gists{/gist_id}","starred_url":"https://api.github.com/users/vicancy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vicancy/subscriptions","organizations_url":"https://api.github.com/users/vicancy/orgs","repos_url":"https://api.github.com/users/vicancy/repos","events_url":"https://api.github.com/users/vicancy/events{/privacy}","received_events_url":"https://api.github.com/users/vicancy/received_events","type":"User","site_admin":false},"body":"@vwxyzh @herohua @superyyrrzz @chenkennt ","created_at":"2016-01-15T15:19:11Z","updated_at":"2016-01-18T05:25:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"08e60f09f09bbaeeb6a43c27cfe5f4829fb22f71","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/docfx/pulls/126/commits","review_comments_url":"https://api.github.com/repos/dotnet/docfx/pulls/126/comments","review_comment_url":"https://api.github.com/repos/dotnet/docfx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/docfx/issues/126/comments","statuses_url":"https://api.github.com/repos/dotnet/docfx/statuses/f17da85880aad731c1677ffe30f63caeeda76a51","head":{"label":"vicancy:jint","ref":"jint","sha":"f17da85880aad731c1677ffe30f63caeeda76a51","user":{"login":"vicancy","id":668244,"avatar_url":"https://avatars.githubusercontent.com/u/668244?v=3","gravatar_id":"","url":"https://api.github.com/users/vicancy","html_url":"https://github.com/vicancy","followers_url":"https://api.github.com/users/vicancy/followers","following_url":"https://api.github.com/users/vicancy/following{/other_user}","gists_url":"https://api.github.com/users/vicancy/gists{/gist_id}","starred_url":"https://api.github.com/users/vicancy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vicancy/subscriptions","organizations_url":"https://api.github.com/users/vicancy/orgs","repos_url":"https://api.github.com/users/vicancy/repos","events_url":"https://api.github.com/users/vicancy/events{/privacy}","received_events_url":"https://api.github.com/users/vicancy/received_events","type":"User","site_admin":false},"repo":{"id":49409630,"name":"docfx","full_name":"vicancy/docfx","owner":{"login":"vicancy","id":668244,"avatar_url":"https://avatars.githubusercontent.com/u/668244?v=3","gravatar_id":"","url":"https://api.github.com/users/vicancy","html_url":"https://github.com/vicancy","followers_url":"https://api.github.com/users/vicancy/followers","following_url":"https://api.github.com/users/vicancy/following{/other_user}","gists_url":"https://api.github.com/users/vicancy/gists{/gist_id}","starred_url":"https://api.github.com/users/vicancy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vicancy/subscriptions","organizations_url":"https://api.github.com/users/vicancy/orgs","repos_url":"https://api.github.com/users/vicancy/repos","events_url":"https://api.github.com/users/vicancy/events{/privacy}","received_events_url":"https://api.github.com/users/vicancy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vicancy/docfx","description":"Tools for building and publishing API documentation for .NET projects","fork":true,"url":"https://api.github.com/repos/vicancy/docfx","forks_url":"https://api.github.com/repos/vicancy/docfx/forks","keys_url":"https://api.github.com/repos/vicancy/docfx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vicancy/docfx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vicancy/docfx/teams","hooks_url":"https://api.github.com/repos/vicancy/docfx/hooks","issue_events_url":"https://api.github.com/repos/vicancy/docfx/issues/events{/number}","events_url":"https://api.github.com/repos/vicancy/docfx/events","assignees_url":"https://api.github.com/repos/vicancy/docfx/assignees{/user}","branches_url":"https://api.github.com/repos/vicancy/docfx/branches{/branch}","tags_url":"https://api.github.com/repos/vicancy/docfx/tags","blobs_url":"https://api.github.com/repos/vicancy/docfx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vicancy/docfx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vicancy/docfx/git/refs{/sha}","trees_url":"https://api.github.com/repos/vicancy/docfx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vicancy/docfx/statuses/{sha}","languages_url":"https://api.github.com/repos/vicancy/docfx/languages","stargazers_url":"https://api.github.com/repos/vicancy/docfx/stargazers","contributors_url":"https://api.github.com/repos/vicancy/docfx/contributors","subscribers_url":"https://api.github.com/repos/vicancy/docfx/subscribers","subscription_url":"https://api.github.com/repos/vicancy/docfx/subscription","commits_url":"https://api.github.com/repos/vicancy/docfx/commits{/sha}","git_commits_url":"https://api.github.com/repos/vicancy/docfx/git/commits{/sha}","comments_url":"https://api.github.com/repos/vicancy/docfx/comments{/number}","issue_comment_url":"https://api.github.com/repos/vicancy/docfx/issues/comments{/number}","contents_url":"https://api.github.com/repos/vicancy/docfx/contents/{+path}","compare_url":"https://api.github.com/repos/vicancy/docfx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vicancy/docfx/merges","archive_url":"https://api.github.com/repos/vicancy/docfx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vicancy/docfx/downloads","issues_url":"https://api.github.com/repos/vicancy/docfx/issues{/number}","pulls_url":"https://api.github.com/repos/vicancy/docfx/pulls{/number}","milestones_url":"https://api.github.com/repos/vicancy/docfx/milestones{/number}","notifications_url":"https://api.github.com/repos/vicancy/docfx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vicancy/docfx/labels{/name}","releases_url":"https://api.github.com/repos/vicancy/docfx/releases{/id}","created_at":"2016-01-11T07:31:48Z","updated_at":"2016-01-11T07:31:51Z","pushed_at":"2016-01-18T02:34:16Z","git_url":"git://github.com/vicancy/docfx.git","ssh_url":"git@github.com:vicancy/docfx.git","clone_url":"https://github.com/vicancy/docfx.git","svn_url":"https://github.com/vicancy/docfx","homepage":"http://dotnet.github.io/docfx/","size":61175,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"dev"}},"base":{"label":"dotnet:dev","ref":"dev","sha":"d439c2c7ef29e97fb6e8b1337ebb79d4b53dcae1","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":38007053,"name":"docfx","full_name":"dotnet/docfx","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/docfx","description":"Tools for building and publishing API documentation for .NET projects","fork":false,"url":"https://api.github.com/repos/dotnet/docfx","forks_url":"https://api.github.com/repos/dotnet/docfx/forks","keys_url":"https://api.github.com/repos/dotnet/docfx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/docfx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/docfx/teams","hooks_url":"https://api.github.com/repos/dotnet/docfx/hooks","issue_events_url":"https://api.github.com/repos/dotnet/docfx/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/docfx/events","assignees_url":"https://api.github.com/repos/dotnet/docfx/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/docfx/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/docfx/tags","blobs_url":"https://api.github.com/repos/dotnet/docfx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/docfx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/docfx/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/docfx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/docfx/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/docfx/languages","stargazers_url":"https://api.github.com/repos/dotnet/docfx/stargazers","contributors_url":"https://api.github.com/repos/dotnet/docfx/contributors","subscribers_url":"https://api.github.com/repos/dotnet/docfx/subscribers","subscription_url":"https://api.github.com/repos/dotnet/docfx/subscription","commits_url":"https://api.github.com/repos/dotnet/docfx/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/docfx/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/docfx/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/docfx/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/docfx/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/docfx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/docfx/merges","archive_url":"https://api.github.com/repos/dotnet/docfx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/docfx/downloads","issues_url":"https://api.github.com/repos/dotnet/docfx/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/docfx/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/docfx/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/docfx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/docfx/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/docfx/releases{/id}","created_at":"2015-06-24T19:43:53Z","updated_at":"2016-01-17T03:47:14Z","pushed_at":"2016-01-18T02:34:17Z","git_url":"git://github.com/dotnet/docfx.git","ssh_url":"git@github.com:dotnet/docfx.git","clone_url":"https://github.com/dotnet/docfx.git","svn_url":"https://github.com/dotnet/docfx","homepage":"http://dotnet.github.io/docfx/","size":68629,"stargazers_count":155,"watchers_count":155,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":41,"mirror_url":null,"open_issues_count":10,"forks":41,"open_issues":10,"watchers":155,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/docfx/pulls/126"},"html":{"href":"https://github.com/dotnet/docfx/pull/126"},"issue":{"href":"https://api.github.com/repos/dotnet/docfx/issues/126"},"comments":{"href":"https://api.github.com/repos/dotnet/docfx/issues/126/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/docfx/pulls/126/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/docfx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/docfx/pulls/126/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/docfx/statuses/f17da85880aad731c1677ffe30f63caeeda76a51"}}}}