public JObject humus_to_corg(object root, JArray j)
        {
            if (j != null && j.Count == 2 && is_int(j[1] as JValue))
            {
                var res = new JObject();
                res.Add("result", SoilIO.humus_class_to_corg((int)j[1]));
                res.Add("errors", new JArray());
                res.Add("success", true);
                return(res);
            }
            var res2 = new JObject();

            res2.Add("result", j);
            res2.Add("errors", new JArray("Couldn't convert humus level to corg: " + j.ToString() + "!"));
            res2.Add("success", false);
            return(res2);
        }
        public JObject ka5_to_sand(object root, JArray j)
        {
            if (j != null && j.Count == 2 && is_string_type(j[1] as JValue))
            {
                var res = new JObject();
                res.Add("result", SoilIO.ka5_texture_to_sand(j[1].ToString()));
                res.Add("errors", new JArray());
                res.Add("success", true);
                return(res);
            }
            var res2 = new JObject();

            res2.Add("result", j);
            res2.Add("errors", new JArray("Couldn't get soil sand content from KA5 soil class: " + j.ToString() + "!"));
            res2.Add("success", false);
            return(res2);
        }
        public JObject sand_clay_to_lambda(object root, JArray j)
        {
            if (j != null && j.Count == 2 && is_float(j[1] as JValue) && is_float(j[2] as JValue))
            {
                var res = new JObject();
                res.Add("result", SoilIO.sand_and_clay_to_lambda((double)j[1], (double)j[2]));
                res.Add("errors", new JArray());
                res.Add("success", true);
                return(res);
            }
            var res2 = new JObject();

            res2.Add("result", j);
            res2.Add("errors", new JArray("Couldn't get lambda value from soil sand and clay content: " + j.ToString() + "!"));
            res2.Add("success", false);
            return(res2);
        }
        public JObject ld_to_trd(JObject root, JArray j)
        {
            if (j != null && j.Count == 3 && is_int(j[1] as JValue) && is_float(j[2] as JValue))
            {
                var res = new JObject();
                res.Add("result", SoilIO.bulk_density_class_to_raw_density((int)j[1], (double)j[2]));
                res.Add("errors", new JArray());
                res.Add("success", true);
                return(res);
            }
            var res2 = new JObject();

            res2.Add("result", j);
            res2.Add("errors", new JArray("Couldn't convert bulk density class to raw density using function: " + j.ToString() + "!"));
            res2.Add("success", false);
            return(res2);
        }