Re: [Dev] Comparing two json objects
H Shiva/Dimuthu Thanks for the prompt reply. @Shiva i used that JsonAssert according to the blog i mentioned, and added the below dependency dependency groupIdorg.skyscreamer/groupId artifactIdjsonassert/artifactId version1.2.3/version /dependency On Mon, Jan 26, 2015 at 5:36 PM, Dimuthu De Lanerolle dimut...@wso2.com wrote: Hi Shashika, Hope this helpsl. [1] http://stackoverflow.com/questions/2253750/compare-two-json-objects-in-java [2] simple.parser.JSONParser - https://github.com/wso2-dev/carbon-platform-integration-utils/blob/master/common-framework-tests/src/main/java/org/wso2/carbon/integration/common/tests/JaggeryServerTest.java Regards On Mon, Jan 26, 2015 at 5:34 PM, Shiva Balachandran sh...@wso2.com wrote: Hi Shashika, You can try JsonUnit https://github.com/lukas-krecan/JsonUnit. It can compare two JSON objects and report differences. It's built on top of Jackson. E.g- assertJsonEquals({\test\:1}, {\n\test\: 2\n}); Results - java.lang.AssertionError: JSON documents are different: Different value found in node test. Expected 1, got 2. or You can try JsonAssert [1]. [1] - http://jsonassert.skyscreamer.org/quickstart.html Thank you, Shiva Balachandran On Mon, Jan 26, 2015 at 5:13 PM, Shashika Karunatilaka shashi...@wso2.com wrote: Hi, Currently i need to do the $subject for a test case, found this blog [1]. what is the best way of doing $subject [1] http://madhukaudantha.blogspot.com/2014/03/comparing-json-java-testing.html Thank you. -- Shashika Prabath Karunatilaka, Software Engineer, WSO2, Inc: http://wso2.com/ mobile : +94 77 7487792 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev -- Shiva Balachandran Software Engineer WSO2 Inc. Mobile - +94 774445788 Blog - https://shivabalachandran.wordpress.com/ ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev -- Dimuthu De Lanerolle Software Engineer WSO2 Inc. lean . enterprise . middlewear. http://wso2.com/ Tel. : +94 11 2145345 Fax : +94 11 2145300 email : dimut...@wso2.com -- Shashika Prabath Karunatilaka, Software Engineer, WSO2, Inc: http://wso2.com/ mobile : +94 77 7487792 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
[Dev] Comparing two json objects
Hi, Currently i need to do the $subject for a test case, found this blog [1]. what is the best way of doing $subject [1] http://madhukaudantha.blogspot.com/2014/03/comparing-json-java-testing.html Thank you. -- Shashika Prabath Karunatilaka, Software Engineer, WSO2, Inc: http://wso2.com/ mobile : +94 77 7487792 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] Comparing two json objects
Hi Shashika, You can try JsonUnit https://github.com/lukas-krecan/JsonUnit. It can compare two JSON objects and report differences. It's built on top of Jackson. E.g- assertJsonEquals({\test\:1}, {\n\test\: 2\n}); Results - java.lang.AssertionError: JSON documents are different: Different value found in node test. Expected 1, got 2. or You can try JsonAssert [1]. [1] - http://jsonassert.skyscreamer.org/quickstart.html Thank you, Shiva Balachandran On Mon, Jan 26, 2015 at 5:13 PM, Shashika Karunatilaka shashi...@wso2.com wrote: Hi, Currently i need to do the $subject for a test case, found this blog [1]. what is the best way of doing $subject [1] http://madhukaudantha.blogspot.com/2014/03/comparing-json-java-testing.html Thank you. -- Shashika Prabath Karunatilaka, Software Engineer, WSO2, Inc: http://wso2.com/ mobile : +94 77 7487792 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev -- Shiva Balachandran Software Engineer WSO2 Inc. Mobile - +94 774445788 Blog - https://shivabalachandran.wordpress.com/ ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] Comparing two json objects
Hi Shashika, Hope this helpsl. [1] http://stackoverflow.com/questions/2253750/compare-two-json-objects-in-java [2] simple.parser.JSONParser - https://github.com/wso2-dev/carbon-platform-integration-utils/blob/master/common-framework-tests/src/main/java/org/wso2/carbon/integration/common/tests/JaggeryServerTest.java Regards On Mon, Jan 26, 2015 at 5:34 PM, Shiva Balachandran sh...@wso2.com wrote: Hi Shashika, You can try JsonUnit https://github.com/lukas-krecan/JsonUnit. It can compare two JSON objects and report differences. It's built on top of Jackson. E.g- assertJsonEquals({\test\:1}, {\n\test\: 2\n}); Results - java.lang.AssertionError: JSON documents are different: Different value found in node test. Expected 1, got 2. or You can try JsonAssert [1]. [1] - http://jsonassert.skyscreamer.org/quickstart.html Thank you, Shiva Balachandran On Mon, Jan 26, 2015 at 5:13 PM, Shashika Karunatilaka shashi...@wso2.com wrote: Hi, Currently i need to do the $subject for a test case, found this blog [1]. what is the best way of doing $subject [1] http://madhukaudantha.blogspot.com/2014/03/comparing-json-java-testing.html Thank you. -- Shashika Prabath Karunatilaka, Software Engineer, WSO2, Inc: http://wso2.com/ mobile : +94 77 7487792 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev -- Shiva Balachandran Software Engineer WSO2 Inc. Mobile - +94 774445788 Blog - https://shivabalachandran.wordpress.com/ ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev -- Dimuthu De Lanerolle Software Engineer WSO2 Inc. lean . enterprise . middlewear. http://wso2.com/ Tel. : +94 11 2145345 Fax : +94 11 2145300 email : dimut...@wso2.com ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev