def to_json(self, pretty: bool = False, sastag: bool = False, **kwargs) -> str:
code = "<STR_LIT>"<EOL>code += "<STR_LIT>"<EOL>if pretty:<EOL><INDENT>code += "<STR_LIT>"<EOL><DEDENT>if not sastag:<EOL><INDENT>code += "<STR_LIT>"<EOL><DEDENT>code +="<STR_LIT>" % (self.libref, self.table, self._dsopts())<EOL>if self.sas.nosub:<EOL><INDENT>print(code)<EOL>return None<EOL><DEDENT>ll = self._is_valid()<EOL>runcode = True<EOL>if ll:<EOL><INDENT>runcode = False<EOL><DEDENT>if runcode:<EOL><INDENT>ll = self.sas.submit(code, "<STR_LIT:text>")<EOL>elog = []<EOL>fpath='<STR_LIT>'<EOL>for line in ll['<STR_LIT>'].splitlines():<EOL><INDENT>if line.startswith('<STR_LIT>'):<EOL><INDENT>fpath = line[<NUM_LIT>:]<EOL><DEDENT>if line.startswith('<STR_LIT>'):<EOL><INDENT>elog.append(line)<EOL><DEDENT><DEDENT>if len(elog):<EOL><INDENT>raise RuntimeError("<STR_LIT:\n>".join(elog))<EOL><DEDENT>if len(fpath):<EOL><INDENT>with open(fpath, '<STR_LIT:r>') as myfile:<EOL><INDENT>json_str = myfile.read()<EOL><DEDENT>return json_str<EOL><DEDENT><DEDENT>
Export this SAS Data Set to a JSON Object
PROC JSON documentation: http://go.documentation.sas.com/?docsetId=proc&docsetVersion=9.4&docsetTarget=p06hstivs0b3hsn1cb4zclxukkut.htm&locale=en

:param pretty: boolean False return JSON on one line True returns formatted JSON
:param sastag: include SAS meta tags
:param kwargs:
:return: JSON str