Main purpose of this PR is to minimize copying (potentially large) RPC named arguments when calling .substr() by using std::string_view instead of std::string. Furthermore, cleans up the code by removing unnecessary complexity in ParseNonRFCJSONValue() (done first to avoid refactoring required to concatenate string and string_view), updates some naming and adds a few test cases. Should not introduce any behaviour change.
Backport of core#26612.