changes best_effort_json_encode to do not convert json to string #59
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When I was testing sending JSONs in arguments, I found out that everything is converted to the string. In consequence Seq, is interpreting JSON structures as a plain text. In this situation, we are loosing Seq features related to handling JSON data, like easy querying on JSON fields, folding, coloring etc. Therefore I changed best_effort_json_encode function. Now it is checking if a given parameter is a JSON object, and if it is, then it does not convert it to a string. If given argument is not a proper JSON structure (json.dumps throw TypeError), then it converts it to a string like it was before.
Before:
![image](https://private-user-images.githubusercontent.com/22113075/260008326-fa7f9841-a436-4613-b1e5-3f9d6f985054.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEzNDAyNzEsIm5iZiI6MTcyMTMzOTk3MSwicGF0aCI6Ii8yMjExMzA3NS8yNjAwMDgzMjYtZmE3Zjk4NDEtYTQzNi00NjEzLWIxZTUtM2Y5ZDZmOTg1MDU0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE4VDIxNTkzMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJlZmU0NTIwNjU1YmJkOTFkZjIwN2UyOWQzYmNiZDk1ZjQ5MzU4ODhiMzU2OWFlZjIzZjU5NTY4MzVkOWQxY2UmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.iWyFyP4sEdfzSw4TWCC_WnAf6clZ9QusrKSz9844fg0)
After:
![image](https://private-user-images.githubusercontent.com/22113075/260005767-a5172310-009d-4947-baa3-22fa5c5d6c59.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEzNDAyNzEsIm5iZiI6MTcyMTMzOTk3MSwicGF0aCI6Ii8yMjExMzA3NS8yNjAwMDU3NjctYTUxNzIzMTAtMDA5ZC00OTQ3LWJhYTMtMjJmYTVjNWQ2YzU5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE4VDIxNTkzMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTgxM2FmYzU4MDFlZmY3NjQwNjMzNDg2NGJiYWVlYjBkODZjM2UxYjhjMWU4YTdmYjk1YjNkZDBjOWRmNTM3MjMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.AduJLhHC01QmswSqMT0ZYe1rNyTcaIKGb-48M_HSkik)
I also added JSON objects to arguments in tests.