You are asking the wrong question, JSON syntax is not the main problem here. Your problem is AT command syntax.
AT#MQPUBS=1,topic_2,0,0,{"Name":"Andrew"},{"Location":"UK"},{"Age":"51"}
This is in absolutely no way valid AT command syntax. AT commands have only two kinds of parameters, numbers and strings. Strings should ALWAYS be enclosed with double quotes at the beginning and end. From the V.250 standard (which is the AT command standard that everyone working with AT commands needs to read):
5.4.2.2 String constants ... String constants
shall be bounded at the beginning and end by the double-quote character ... The double-quote character, used as the beginning and ending string delimiter,
shall be represented within a string constant as "\22".
Thus the topic_2
argument above is not at all a valid string without the surrounding quotes. If you read the documentation for the AT#MQPUBS
command carefully it should state that the second argument is of type string. And looking at it the first argument is actually also a string.
To convert the whole command line into valid syntax it should be
AT#MQPUBS="1","topic_2",0,0,"{\22Name\22:\22Andrew\22},{\22Location\22:\22UK\22},{\22Age\22:\2251\22}"
although at that point you might start looking into JSON syntax because I assume you rather should have "{{\22Name\22: ... :\2251\22}}".
PS Also note that almost all strings are subject to AT+CSCS
conversion (there exists a few exceptions, but then the documentation should explicitly say so, and AT#MQPUBS
is not such an exception).