<commit_before>﻿using Newtonsoft.Json.Linq;

namespace Fitbit.Api.Portable
{
    internal class JsonDotNetSerializer
    {
        /// <summary>
        /// Root property value; only required if trying to access nested information or an array is hanging off a property
        /// </summary>
        public string RootProperty { get; set; }

        public T Deserialize<T>(string data)
        {
            if (string.IsNullOrWhiteSpace(data))
            {
                return default(T);
            }

            JToken o = JToken.Parse(data);
            return Deserialize<T>(o);
        }

        public T Deserialize<T>(JToken token)
        {
            if (token == null)
            {
                return default(T);
            }

            T result = string.IsNullOrWhiteSpace(RootProperty) ? token.ToObject<T>() : token[RootProperty].ToObject<T>();
            return result;            
        }
    }
}<commit_msg>Internalise the JToken Deserialize method<commit_after>﻿using Newtonsoft.Json.Linq;

namespace Fitbit.Api.Portable
{
    internal class JsonDotNetSerializer
    {
        /// <summary>
        /// Root property value; only required if trying to access nested information or an array is hanging off a property
        /// </summary>
        public string RootProperty { get; set; }

        public T Deserialize<T>(string data)
        {
            if (string.IsNullOrWhiteSpace(data))
            {
                return default(T);
            }

            JToken o = JToken.Parse(data);
            return Deserialize<T>(o);
        }

        internal T Deserialize<T>(JToken token)
        {
            if (token == null)
            {
                return default(T);
            }

            T result = string.IsNullOrWhiteSpace(RootProperty) ? token.ToObject<T>() : token[RootProperty].ToObject<T>();
            return result;            
        }
    }
}
{'fraction_non_alphanumeric': 0.09707724425887265, 'fraction_numerical': 0.0, 'mean_word_length': 1.622435020519836, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5549388', 'n_tokens_mistral': 500, 'n_tokens_neox': 490, 'n_words': 128}