using System.Collections;
using System.Collections.Generic;
using CsQuery.ExtensionMethods;
using CsQuery.ExtensionMethods.Internal;
public static void Main()
Hashtable keys = new Hashtable();
keys.Add("providerid", "1");
keys.Add("providercode", "monstercode");
keys.Add("providername", "monstername");
string jsonCsQuery = keys.ToJSON();
string jsonNewtonsoft = JsonConvert.SerializeObject(keys);
Console.WriteLine("CsQuery "+jsonCsQuery);
Console.WriteLine("Newtonsoft "+jsonNewtonsoft);
List<KeyValuePair<string, string>> theList = new List<KeyValuePair<string, string>>();
theList.Add(new KeyValuePair<string, string>("providerid", "1"));
theList.Add(new KeyValuePair<string, string>("providercode", "monstercode"));
theList.Add(new KeyValuePair<string, string>("providername", "monstercode"));
string jsonKVPCsQuery = theList.ToJSON();
string jsonKVPNewtonsoft = JsonConvert.SerializeObject(theList);
Console.WriteLine("CsQuery "+jsonKVPCsQuery);
Console.WriteLine("Newtonsoft "+jsonKVPNewtonsoft);
Dictionary<string, string> dict = new Dictionary<string, string>();
dict.Add("providerid", "1");
dict.Add("providercode", "monstercode");
dict.Add("providername", "monstercode");
string jsonDictCsQuery = dict.ToJSON();
string jsonDictNewtonsoft = JsonConvert.SerializeObject(dict);
Console.WriteLine("CsQuery "+jsonDictCsQuery);
Console.WriteLine("Newtonsoft "+jsonDictCsQuery);
string cres = "{\"size\": 0,\"query\": {\"bool\": {\"must\": [{ \"match_phrase\": { \"company.name\":\"amazon warehouse\" } }],\"filter\": [{ \"term\": { \"action.keyword\": \"I\" } }]}},\"aggs\": {\"first_level_counts_aggs\": {\"terms\": { \"script\": {\"lang\": \"painless\",\"inline\": \"if (doc[\'company.name.keyword\'].value != null) {doc[\'company.name.keyword\'].value.toLowerCase();}\"},\"size\": 500},\"aggs\": {\"totaljobcount\": {\"value_count\": {\"field\": \"postingid\"}},\"second_level_counts_aggs\": {\"terms\": { \"script\": {\"lang\": \"painless\",\"inline\": \"if (doc[\'company.normalizedcompanyname.keyword\'].value != null) {doc[\'company.normalizedcompanyname.keyword\'].value.toLowerCase();}\"},\"size\": 1},\"aggs\": {\"totaljobcount\": {\"value_count\": {\"field\": \"postingid\"}}}}}}}}\n";