*** json.c	Fri May 28 16:18:49 2010
--- json-attributes.c	Fri May 28 16:18:58 2010
***************
*** 43,48 ****
--- 43,49 ----
  const char Ptype[] = "type";
  const char Pcomment[] = "comment";
  const char Pmembers[] = "members";
+ const char Pattributes[] = "attributes";
  
  void JsonRemoveComma(OutBuffer *buf);
  
***************
*** 252,257 ****
--- 253,374 ----
  void PostBlitDeclaration::toJsonBuffer(OutBuffer *buf)   { }
  #endif
  
+ int JsonEmitProtection(OutBuffer *buf, PROT prot)
+ {
+     const char *p;
+ 
+     switch (prot)
+     {
+         case PROTpackage:       p = "package";   break;
+         case PROTprotected:     p = "protected"; break;
+         case PROTprivate:       p = "private"; break;
+         case PROTexport:        p = "export";    break;
+         default:                p = NULL;        break;
+     }
+     if (p)
+     {
+         if (buf)
+         {
+             JsonString(buf, p);
+             buf->writestring(",\n");
+         }
+         return 1;
+     }
+     return 0;
+ }
+ 
+ int JsonEmitAttributes(OutBuffer *buf, Dsymbol *s)
+ {
+     int count = 0;
+     if (buf)
+     {
+         int precount = JsonEmitAttributes(NULL, s);
+         if (!precount)
+         {
+             return 0;
+         }
+         JsonString(buf, Pattributes);
+         buf->writestring(" : [\n");
+     }
+     if (s->isDeprecated())
+     {
+         if (buf)
+         {
+             JsonString(buf, "deprecated");
+             buf->writestring(",\n");
+         }
+         count++;
+     }
+     Declaration *d = s->isDeclaration();
+     if (d)
+     {
+         count += JsonEmitProtection(buf, d->protection);
+         if (d->isAbstract())
+         {
+             if (buf)
+             {
+                 JsonString(buf, "abstract");
+                 buf->writestring(",\n");
+             }
+             count++;
+         }
+         if (d->isStatic())
+         {
+             if (buf)
+             {
+                 JsonString(buf, "static");
+                 buf->writestring(",\n");
+             }
+             count++;
+         }
+         if (d->isConst())
+         {
+             if (buf)
+             {
+                 JsonString(buf, "const");
+                 buf->writestring(",\n");
+             }
+             count++;
+         }
+ #if DMDV2
+         if (d->isImmutable())
+         {
+             if (buf)
+             {
+                 JsonString(buf, "immutable");
+                 buf->writestring(",\n");
+             }
+             count++;
+         }
+ #endif
+         if (d->isFinal())
+         {
+             if (buf)
+             {
+                 JsonString(buf, "final");
+                 buf->writestring(",\n");
+             }
+             count++;
+         }
+         if (d->isSynchronized())
+         {
+             if (buf)
+             {
+                 JsonString(buf, "synchronized");
+                 buf->writestring(",\n");
+             }
+             count++;
+         }
+     }
+     if (buf)
+     {
+         JsonRemoveComma(buf);
+         buf->writestring("]\n");
+         buf->writestring(",\n");
+     }
+     return count;
+ }
+ 
  void Declaration::toJsonBuffer(OutBuffer *buf)
  {
      //printf("Declaration::toJsonBuffer()\n");
***************
*** 273,278 ****
--- 390,397 ----
      {
          JsonProperty(buf, "base", td->basetype->toChars());
      }
+     
+     JsonEmitAttributes(buf, this);
  
      JsonRemoveComma(buf);
      buf->writestring("}\n");
***************
*** 314,319 ****
--- 433,440 ----
              buf->writestring("],\n");
          }
      }
+     
+     JsonEmitAttributes(buf, this);
  
      if (members)
      {
***************
*** 349,354 ****
--- 470,477 ----
  
      if (loc.linnum)
          JsonProperty(buf, Pline, loc.linnum);
+     
+     JsonEmitAttributes(buf, this);
  
      JsonString(buf, Pmembers);
      buf->writestring(" : [\n");
***************
*** 397,402 ****
--- 520,527 ----
  
      if (memtype)
          JsonProperty(buf, "base", memtype->toChars());
+     
+     JsonEmitAttributes(buf, this);
  
      if (members)
      {
