def METHOD_NAME(json_str, key=None):
    """Given a json_str representing a json string, with optionally a name "key"
    at the top level, Return a C++ AnyMap representation of the json in string format.
    """
    scrmap = json.loads(json_str, object_pairs_hook=OrderedDict)
    if key:
        scrmap = scrmap[key]
    return ''.join(generate_anymap(scrmap, 0))