Esempio n. 1
0
        public void ExternalStaticMethodPreloadedFromAssembly()
        {
            var currentDirectory = Path.GetDirectoryName(typeof(ExternalAssemblyBugTests).Assembly.Location);
            var searchPath       = Path.GetFullPath(currentDirectory + @"\..\..\..\..\");

            var assemblyFilePath = Directory.GetFiles(
                searchPath, "ExternalMethods.dll", SearchOption.AllDirectories).First();

            var loadContext = new AssemblyLoadContext(name: Guid.NewGuid().ToString(), isCollectible: true);

            {
                // read the file and release it immediately (do not keep handle)
                var stream = new FileStream(assemblyFilePath, FileMode.Open, FileAccess.Read, FileShare.Read);
                // alternatively can be used the line below:
                //using var stream = new MemoryStream(File.ReadAllBytes(assemblyFilePath));
                var loadedAssembly = loadContext.LoadFromStream(stream);

                Assert.AreEqual("<Unknown>", loadedAssembly.ManifestModule.FullyQualifiedName);
                Assert.AreEqual("<Unknown>", loadedAssembly.ManifestModule.Name);
                Assert.AreEqual("ExternalMethods.dll", loadedAssembly.ManifestModule.ScopeName);
                // it seems that ScopeName is only reliable information in this case
            }
            const string input       = "{ }";
            const string transformer = "{ \"result\": \"#StaticMethod()\" }";

            _context.RegisterCustomFunction("ExternalMethods", "ExternalMethods.ExternalClass", "StaticMethod");
            var result = new JsonTransformer(_context).Transform(transformer, input);

            Assert.AreEqual("{\"result\":\"External Static\"}", result);

            _context.ClearCustomFunctionRegistrations();
            loadContext.Unload();
        }
Esempio n. 2
0
        public void XmlWithCustomFunctionsTest()
        {
            var input = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> <root> <root> <custom>#StaticMethod()</custom> <ifconditiontesttrue>#ifcondition(#valueof($.menu.id.file),csv,#valueof($.menu.value.Window),fail)</ifconditiontesttrue> <ifconditiontestfalse>#ifcondition(#valueof($.menu.id.file),xml,#valueof($.menu.value.Window),fail)</ifconditiontestfalse> <stringresult> <lastindexofand>#lastindexof(#valueof($.stringref),and)</lastindexofand> <firstindexofand>#firstindexof(#valueof($.stringref),and)</firstindexofand> <subsrting>#substring(#valueof($.stringref),8,10)</subsrting> <concat>#concat(#valueof($.menu.id.file),#valueof($.menu.value.Window))</concat> </stringresult> <mathresult> <add>#add(#valueof($.numbers[0]),3)</add> <subtract>#subtract(#valueof($.numbers[4]),#valueof($.numbers[0]))</subtract> <multiply>#multiply(2,#valueof($.numbers[2]))</multiply> <divide>#divide(9,3)</divide> </mathresult> <conacted>#concatall(#valueof($.d))</conacted> <sum>#sum(#valueof($.numbers))</sum> <avg>#average(#valueof($.numbers))</avg> <min>#min(#valueof($.numbers))</min> <max>#max(#valueof($.numbers))</max> <arrayconacted>#concatallatpath(#valueof($.x),$.v.a)</arrayconacted> <arraysum>#sumatpath(#valueof($.x),$.v.c)</arraysum> <arrayavg>#averageatpath(#valueof($.x),$.v.c)</arrayavg> <arraymin>#minatpath(#valueof($.x),$.v.b)</arraymin> <arraymax>#maxatpath(#valueof($.x),$.v.b)</arraymax> </root> <FullName>#concat(#concat(#concat(#valueof($.Name), ),#concat(#valueof($.MiddleName), )),#valueof($.Surname))</FullName> <Contact_Information> <City>#substring(#valueof($.ContactInformation),#add(#firstindexof(#valueof($.ContactInformation),:),1),#subtract(#subtract(#lastindexof(#valueof($.ContactInformation),:),#firstindexof(#valueof($.ContactInformation),:)),1))</City> <PhoneNumber>#substring(#valueof($.ContactInformation),#add(#lastindexof(#valueof($.ContactInformation),:),1),#subtract(#lastindexof(#valueof($.ContactInformation),),#lastindexof(#valueof($.ContactInformation),:)))</PhoneNumber> <Street_Name>#substring(#valueof($.ContactInformation),0,#firstindexof(#valueof($.ContactInformation),:))</Street_Name> </Contact_Information> <Personal_Information> <Age>#substring(#valueof($.PersonalInformation),0,#firstindexof(#valueof($.PersonalInformation),:))</Age> <Ethnicity>#substring(#valueof($.PersonalInformation),#add(#lastindexof(#valueof($.PersonalInformation),:),1),#subtract(#lastindexof(#valueof($.PersonalInformation),),#lastindexof(#valueof($.PersonalInformation),:)))</Ethnicity> <LogId>#valueof($.LogId)</LogId> <Civil_Status>#substring(#valueof($.PersonalInformation),#add(#firstindexof(#valueof($.PersonalInformation),:),1),#subtract(#subtract(#lastindexof(#valueof($.PersonalInformation),:),#firstindexof(#valueof($.PersonalInformation),:)),1))</Civil_Status> </Personal_Information> <Custom>#customfunction(ExternalMethods,SeasonsHelper.Season.findseason,#valueof($.tree.branch.leaf),#valueof($.tree.branch.flower))</Custom> <iteration>\"#loop($.numbers,<!--Record ends here-->)\": { <Record> <CurrentValue>#currentvalue()</CurrentValue> <CurrentIndex>#currentindex()</CurrentIndex> <IsLast>#ifcondition(#currentindex(),#lastindex(),yes,no)</IsLast> <LastValue>#lastvalue()</LastValue> <SomeValue>#valueof($.LogId)</SomeValue> </Record>} </iteration> <IterateObj> \"#loop($.x,<!-- loop ends -->)\": {<Record> <CurrentValueAtPath>#currentvalueatpath($.v.a)</CurrentValueAtPath> </Record>} </IterateObj> </root>";

            _context.RegisterCustomFunction("ExternalMethods", "ExternalMethods.ExternalClass", "StaticMethod");
            var result = new DataTransformer(_context).Transform(input, ExampleInputs.XmlInput);

            Assert.AreEqual("<?xml version=\"1.0\" encoding=\"UTF-8\" ?> <root> <root> <custom>External Static</custom> <ifconditiontesttrue>popup</ifconditiontesttrue> <ifconditiontestfalse>fail</ifconditiontestfalse> <stringresult> <lastindexofand>21</lastindexofand> <firstindexofand>6</firstindexofand> <subsrting>dveryunuas</subsrting> <concat>csvpopup</concat> </stringresult> <mathresult> <add>4</add> <subtract>4</subtract> <multiply>6</multiply> <divide>3</divide> </mathresult> <conacted>onetwothree</conacted> <sum>15</sum> <avg>3</avg> <min>1</min> <max>5</max> <arrayconacted>a1,a2,a3b1,b2c1,c2,c3</arrayconacted> <arraysum>60</arraysum> <arrayavg>20</arrayavg> <arraymin>1</arraymin> <arraymax>3</arraymax> </root> <FullName>Kari Inger Nordmann</FullName> <Contact_Information> <City>Oslo</City> <PhoneNumber>88880000</PhoneNumber> <Street_Name>Karl johans gate</Street_Name> </Contact_Information> <Personal_Information> <Age>45</Age> <Ethnicity>Norwegian</Ethnicity> <LogId>5000510625</LogId> <Civil_Status>Married</Civil_Status> </Personal_Information> <Custom>summer</Custom> <iteration> <Record> <CurrentValue>1</CurrentValue> <CurrentIndex>0</CurrentIndex> <IsLast>no</IsLast> <LastValue>5</LastValue> <SomeValue>5000510625</SomeValue> </Record><!--Record ends here--> <Record> <CurrentValue>2</CurrentValue> <CurrentIndex>1</CurrentIndex> <IsLast>no</IsLast> <LastValue>5</LastValue> <SomeValue>5000510625</SomeValue> </Record><!--Record ends here--> <Record> <CurrentValue>3</CurrentValue> <CurrentIndex>2</CurrentIndex> <IsLast>no</IsLast> <LastValue>5</LastValue> <SomeValue>5000510625</SomeValue> </Record><!--Record ends here--> <Record> <CurrentValue>4</CurrentValue> <CurrentIndex>3</CurrentIndex> <IsLast>no</IsLast> <LastValue>5</LastValue> <SomeValue>5000510625</SomeValue> </Record><!--Record ends here--> <Record> <CurrentValue>5</CurrentValue> <CurrentIndex>4</CurrentIndex> <IsLast>yes</IsLast> <LastValue>5</LastValue> <SomeValue>5000510625</SomeValue> </Record><!--Record ends here--> </iteration> <IterateObj> <Record> <CurrentValueAtPath>a1,a2,a3</CurrentValueAtPath> </Record><!-- loop ends --><Record> <CurrentValueAtPath>b1,b2</CurrentValueAtPath> </Record><!-- loop ends --><Record> <CurrentValueAtPath>c1,c2,c3</CurrentValueAtPath> </Record><!-- loop ends --> </IterateObj> </root>", result);
        }
Esempio n. 3
0
        public void RegisteredCustomFunction()
        {
            const string input       = "{ \"ExcessQuoteAmendments\": [{ \"Name\": \"test_name\", \"Attributes\": [{ \"CoverageDataType\": \"test_coverage\", \"Value\": \"test_value\"}, { }] }]";
            string       transformer = "{ \"ExcessFormsList\": { \"#loop($.ExcessQuoteAmendments)\": { \"AttributesList\": { \"#loop($.Attributes)\": { \"Value\":\"#aliascustomfunction(#currentvalueatpath($.Value), #currentvalueatpath($.CoverageDataType))\" }}}}}";
            var          context     = new JUSTContext();

            context.RegisterCustomFunction("ExternalMethods", "ExternalMethods.ExternalClass", "CheckNullParameters", "aliascustomfunction");

            var actual = new JsonTransformer(context).Transform(transformer, input);

            Assert.AreEqual("{\"ExcessFormsList\":[{\"AttributesList\":[{\"Value\":\"test_value\"},{\"Value\":null}]}]}", actual);
        }
Esempio n. 4
0
        public void ExternalStaticMethod()
        {
            const string input       = "{ }";
            const string transformer = "{ \"result\": \"#StaticMethod()\" }";

            _context.RegisterCustomFunction("ExternalMethods", "ExternalMethods.ExternalClass", "StaticMethod");
            var result = new JsonTransformer(_context).Transform(transformer, input);

            Assert.AreEqual("{\"result\":\"External Static\"}", result);
        }
Esempio n. 5
0
        public static void Main(string[] args)
        {
            string input = File.ReadAllText("Examples/Input.json");

            string transformer       = File.ReadAllText("Examples/Transformer_valueof.json");
            string transformedString = JsonTransformer.Transform(transformer, input);

            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);


            transformer       = File.ReadAllText("Examples/Transformer_valueofarray.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);


            transformer       = File.ReadAllText("Examples/Transformer_copy.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_replace.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_delete.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);


            transformer       = File.ReadAllText("Examples/Transformer_ifcondition.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_string.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_math.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_aggregate.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_arrayaggregate.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_looping.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_customfunction.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_nestedfunctions.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_xfunctions.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_Existance.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/DataTransformer.xml");
            transformedString = DataTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/DataTransformer.csv");
            transformedString = DataTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer.json");
            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JObject.Parse(transformer), JObject.Parse(input)));
            Console.WriteLine(transformedString);



            Console.WriteLine("################################################################################################");
            string inputJson   = File.ReadAllText("Examples/ValidationInput.json");
            string schemaJsonX = File.ReadAllText("Examples/SchemaX.json");
            string schemaJsonY = File.ReadAllText("Examples/SchemaY.json");

            string InputToSplit = File.ReadAllText("Examples/InputToSplit.json");

            List <string> outputs = JsonTransformer.SplitJson(InputToSplit, "$.cars.Ford").ToList <string>();

            foreach (string output in outputs)
            {
                Console.WriteLine("-----------------------------------------------------");
                Console.WriteLine(output);
            }

            Console.WriteLine("################################################################################################");

            JsonValidator validator = new JsonValidator(inputJson);

            validator.AddSchema("x", schemaJsonX);
            validator.AddSchema("y", schemaJsonY);

            validator.Validate();

            Console.WriteLine("################################################################################################");
            transformer       = File.ReadAllText("Examples/Transformer_nestedloop.json");
            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JObject.Parse(transformer), JObject.Parse(input)));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");
            transformer       = File.ReadAllText("Examples/Transformer_looptests.json");
            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JObject.Parse(transformer), JObject.Parse(input)));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");

            string inputSpecial = File.ReadAllText("Examples/InputSpecial.json");

            transformer       = File.ReadAllText("Examples/Transformer_customfunctionspecial.json");
            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JObject.Parse(transformer), JObject.Parse(inputSpecial)));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");

            string inputUnordered = File.ReadAllText("Examples/Input_Unordered.json");

            transformer       = File.ReadAllText("Examples/Transform_Unordered.json");
            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JObject.Parse(transformer), JObject.Parse(inputUnordered)));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");

            string inputUnordered2 = File.ReadAllText("Examples/Input_Unordered_2.json");

            transformer       = File.ReadAllText("Examples/Transform_Unordered_2.json");
            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JObject.Parse(transformer), JObject.Parse(inputUnordered2)));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");


            string inputDyn = File.ReadAllText("Examples/InputDynamic.json");

            transformer       = File.ReadAllText("Examples/TransformDynamic.json");
            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JObject.Parse(transformer), JObject.Parse(inputDyn)));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");

            transformer       = File.ReadAllText("Examples/Transformer_externalmethods.json");
            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JObject.Parse(transformer), JObject.Parse(input)));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");

            transformer       = File.ReadAllText("Examples/Transformer_array.json");
            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(transformer, input));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");

            transformer       = File.ReadAllText("Examples/Transformer_array.json");
            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JArray.Parse(transformer), input));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");

            transformer = File.ReadAllText("Examples/Transformer_registeredmethods.json");
            JUSTContext.RegisterCustomFunction("ExternalMethods", "ExternalMethods.ExternalClass", "StaticMethod", "External_StaticMethod");
            JUSTContext.RegisterCustomFunction("ExternalMethods", "ExternalMethods.ExternalClass", "StaticTypedParameters", "External_StaticTypedParameters");
            JUSTContext.RegisterCustomFunction("ExternalMethods", "ExternalMethods.ExternalClass", "InstanceMethod", "External_InstanceMethod");
            JUSTContext.RegisterCustomFunction("ExternalMethods", "ExternalMethods.ExternalClass", "TypedParameters", "External_TypedParameters");
            JUSTContext.RegisterCustomFunction("ExternalMethods", "ExternalMethods.ExternalClass", "NavigateTypedParameters", "External_NavigateTypedParameters");

            JUSTContext.RegisterCustomFunction(null, "InternalMethods.InternalClass", "StaticMethod");
            JUSTContext.RegisterCustomFunction(null, "InternalMethods.InternalClass", "StaticTypedParameters");
            JUSTContext.RegisterCustomFunction(null, "InternalMethods.InternalClass", "InstanceMethod");
            JUSTContext.RegisterCustomFunction(null, "InternalMethods.InternalClass", "TypedParameters");
            JUSTContext.RegisterCustomFunction(null, "InternalMethods.InternalClass", "NavigateTypedParameters");

            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JObject.Parse(transformer), JObject.Parse(input)));
            Console.WriteLine(transformedString);

            Console.ReadLine();
        }
Esempio n. 6
0
        public static void Main(string[] args)
        {
            string input = File.ReadAllText("Examples/Input.json");

            string transformer       = File.ReadAllText("Examples/Transformer_valueof.json");
            string transformedString = JsonTransformer.Transform(transformer, input);

            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);


            transformer       = File.ReadAllText("Examples/Transformer_valueofarray.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);


            transformer       = File.ReadAllText("Examples/Transformer_copy.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_replace.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_delete.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);


            transformer       = File.ReadAllText("Examples/Transformer_ifcondition.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_string.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_math.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_aggregate.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_arrayaggregate.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_looping.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_customfunction.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_nestedfunctions.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_xfunctions.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer_Existance.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/DataTransformer.xml");
            transformedString = DataTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/DataTransformer.csv");
            transformedString = DataTransformer.Transform(transformer, input);
            Console.WriteLine("################################################################################################");
            Console.WriteLine(transformedString);

            transformer       = File.ReadAllText("Examples/Transformer.json");
            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JObject.Parse(transformer), JObject.Parse(input)));
            Console.WriteLine(transformedString);



            Console.WriteLine("################################################################################################");
            string inputJson   = File.ReadAllText("Examples/ValidationInput.json");
            string schemaJsonX = File.ReadAllText("Examples/SchemaX.json");
            string schemaJsonY = File.ReadAllText("Examples/SchemaY.json");

            string InputToSplit = File.ReadAllText("Examples/InputToSplit.json");

            List <string> outputs = JsonTransformer.SplitJson(InputToSplit, "$.cars.Ford").ToList <string>();

            foreach (string output in outputs)
            {
                Console.WriteLine("-----------------------------------------------------");
                Console.WriteLine(output);
            }

            Console.WriteLine("################################################################################################");

            JsonValidator validator = new JsonValidator(inputJson);

            validator.AddSchema("x", schemaJsonX);
            validator.AddSchema("y", schemaJsonY);

            validator.Validate();

            Console.WriteLine("################################################################################################");
            transformer       = File.ReadAllText("Examples/Transformer_nestedloop.json");
            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JObject.Parse(transformer), JObject.Parse(input)));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");
            transformer       = File.ReadAllText("Examples/Transformer_looptests.json");
            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JObject.Parse(transformer), JObject.Parse(input)));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");

            string inputSpecial = File.ReadAllText("Examples/InputSpecial.json");

            transformer       = File.ReadAllText("Examples/Transformer_customfunctionspecial.json");
            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JObject.Parse(transformer), JObject.Parse(inputSpecial)));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");

            string inputUnordered = File.ReadAllText("Examples/Input_Unordered.json");

            transformer       = File.ReadAllText("Examples/Transform_Unordered.json");
            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JObject.Parse(transformer), JObject.Parse(inputUnordered)));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");

            string inputUnordered2 = File.ReadAllText("Examples/Input_Unordered_2.json");

            transformer       = File.ReadAllText("Examples/Transform_Unordered_2.json");
            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JObject.Parse(transformer), JObject.Parse(inputUnordered2)));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");


            string inputDyn = File.ReadAllText("Examples/InputDynamic.json");

            transformer       = File.ReadAllText("Examples/TransformDynamic.json");
            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JObject.Parse(transformer), JObject.Parse(inputDyn)));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");

            transformer       = File.ReadAllText("Examples/Transformer_externalmethods.json");
            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JObject.Parse(transformer), JObject.Parse(input)));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");

            transformer       = File.ReadAllText("Examples/Transformer_array.json");
            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(transformer, input));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");

            transformer       = File.ReadAllText("Examples/Transformer_array.json");
            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JArray.Parse(transformer), input));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");

            transformer = File.ReadAllText("Examples/Transformer_registeredmethods.json");
            var context = new JUSTContext();

            context.RegisterCustomFunction("ExternalMethods", "ExternalMethods.ExternalClass", "StaticMethod", "External_StaticMethod");
            context.RegisterCustomFunction("ExternalMethods", "ExternalMethods.ExternalClass", "StaticTypedParameters", "External_StaticTypedParameters");
            context.RegisterCustomFunction("ExternalMethods", "ExternalMethods.ExternalClass", "InstanceMethod", "External_InstanceMethod");
            context.RegisterCustomFunction("ExternalMethods", "ExternalMethods.ExternalClass", "TypedParameters", "External_TypedParameters");
            context.RegisterCustomFunction("ExternalMethods", "ExternalMethods.ExternalClass", "NavigateTypedParameters", "External_NavigateTypedParameters");

            context.RegisterCustomFunction(null, "InternalMethods.InternalClass", "StaticMethod");
            context.RegisterCustomFunction(null, "InternalMethods.InternalClass", "StaticTypedParameters");
            context.RegisterCustomFunction(null, "InternalMethods.InternalClass", "InstanceMethod");
            context.RegisterCustomFunction(null, "InternalMethods.InternalClass", "TypedParameters");
            context.RegisterCustomFunction(null, "InternalMethods.InternalClass", "NavigateTypedParameters");

            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JObject.Parse(transformer), JObject.Parse(input), context));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");

            transformer = File.ReadAllText("Examples/Transformer_registeredmethods.json");
            JsonTransformer.GlobalContext.RegisterCustomFunction("ExternalMethods", "ExternalMethods.ExternalClass", "StaticMethod", "External_StaticMethod");
            JsonTransformer.GlobalContext.RegisterCustomFunction("ExternalMethods", "ExternalMethods.ExternalClass", "StaticTypedParameters", "External_StaticTypedParameters");
            JsonTransformer.GlobalContext.RegisterCustomFunction("ExternalMethods", "ExternalMethods.ExternalClass", "InstanceMethod", "External_InstanceMethod");
            JsonTransformer.GlobalContext.RegisterCustomFunction("ExternalMethods", "ExternalMethods.ExternalClass", "TypedParameters", "External_TypedParameters");
            JsonTransformer.GlobalContext.RegisterCustomFunction("ExternalMethods", "ExternalMethods.ExternalClass", "NavigateTypedParameters", "External_NavigateTypedParameters");

            JsonTransformer.GlobalContext.RegisterCustomFunction(null, "InternalMethods.InternalClass", "StaticMethod");
            JsonTransformer.GlobalContext.RegisterCustomFunction(null, "InternalMethods.InternalClass", "StaticTypedParameters");
            JsonTransformer.GlobalContext.RegisterCustomFunction(null, "InternalMethods.InternalClass", "InstanceMethod");
            JsonTransformer.GlobalContext.RegisterCustomFunction(null, "InternalMethods.InternalClass", "TypedParameters");
            JsonTransformer.GlobalContext.RegisterCustomFunction(null, "InternalMethods.InternalClass", "NavigateTypedParameters");

            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JObject.Parse(transformer), JObject.Parse(input)));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");

            JsonTransformer.GlobalContext.EvaluationMode = EvaluationMode.Strict;

            inputDyn          = File.ReadAllText("Examples/InputDynamic.json");
            transformer       = "{ \"Result\": { \"Header\": \"JsonTransform\", \"#eval(#valueof($.Tree.Flower))\": \"x\", \"#ifgroup(#exists($.Tree.Flower))\": { \"Comment\": { \"Statement\": \"Flower Exists\" } } }}";
            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JObject.Parse(transformer), JObject.Parse(inputDyn)));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");

            JsonTransformer.GlobalContext.EvaluationMode = EvaluationMode.FallbackToDefault;

            inputDyn    = File.ReadAllText("Examples/InputDynamic.json");
            transformer = "{ \"Result\": { \"Header\": \"JsonTransform\", \"#ifgroup(1)\": { \"State\": { \"Value1\": \"#valueof($.Tree.Branch)\", \"Value2\": \"#valueof($.Tree.Flower)\" }} } }";

            transformedString = JsonConvert.SerializeObject
                                    (JsonTransformer.Transform(JObject.Parse(transformer), JObject.Parse(inputDyn)));
            Console.WriteLine(transformedString);

            Console.WriteLine("################################################################################################");

            input             = File.ReadAllText("Examples/Input.json");
            transformer       = File.ReadAllText("Examples/Transformer_typeconversion.json");
            transformedString = JsonTransformer.Transform(transformer, input);
            Console.WriteLine(transformedString);

            Console.ReadLine();
        }