Writing data in JSON format error

Hi,

I am getting error while converting the data into JSON and writing into textfile.Please find the below code snippet.

d1.toJSON.saveAsTextFile("/tmp/python/jsn")
Traceback (most recent call last):
File “”, line 1, in
AttributeError: ‘function’ object has no attribute ‘saveAsTextFile’.

Please help