title: How to add recursive `.json()` method to subclass of **NamedTuple**
body: <p>I currently have a couple of classes following the pattern described in the code below:</p>
  <pre class="lang-py prettyprint-override"><code>from typing import NamedTuple
  
  class Data(NamedTuple):
     name: str,
     value: float
     
     def json(self):
         return {'name': self.name, 'value': self.value}
      
  </code></pre>
  <p>Instead of defining a <code>json</code> method in every new class that I create, I would like to extend <code>typing.NamedTuple</code>, so that I can extend from my new class without having to define the json method in the subclasses.  <code>typing.NamedTuple</code> already provides the <code>_asdict</code> method, but this method is not sufficient because it is not recursive (Nested namedtuples will not be converted to dict objects).</p>
  <p>I have tried to attempt this in the code below:</p>
  <pre><code>class JsonNamedTuple(NamedTuple):
      def json(self):
          # some slightly complex recursive code here
  
  class Data(JsonNamedTuple):
      name: str,
      value: float
  
  a = Data('asdf', 0.5)
  </code></pre>
  <p>I get this error:
  <code>TypeError: &lt;lambda&gt;() takes 1 positional argument but 3 were given</code></p>
  <p>Is there a way to extend <code>typing.NamedTuple</code> without getting this error?</p>