# toJson method

1. @override

Map<String, Object> toJson()
override

Returns a JSON representation of this entity.

## Implementation

    @override
    Map<String, Object> toJson() {
      Map<String, Object> result = {};
      result['declaration'] = 'source';
      result['name'] = getName();
      result['parentLibrary'] = getParentLibrary().toJson();

      final annotations = getAnnotations().map((a) => a.toJson()).toList();
      if (annotations.isNotEmpty) {
        result['annotations'] = annotations;
      }

      final sourceLocation = getSourceLocation();
      if (sourceLocation != null) {
        result['sourceLocation'] = sourceLocation.toString();
      }

      result['runtimeType'] = runtimeType.toString();

      return result;
    }